Content deleted Content added
a unit tester for convert; hoping that simplicity will allow many tests to be run |
fiddle so output with disp=table works in a table cell |
||
Line 94:
return text:gsub('\n', '\\n')
end
local function
-- This is possibly adequate for testing {{convert}} where want wikitext
return text:gsub('\\n', '<br />')▼
-- like '[[kilogram|kg]]' to be unchanged so the link works and so the
-- rendered text is short, but need more work if want to use this module
-- to test arbitrary templates.
text = text:gsub('{', '{')
if text:find('align%s*=') then
-- This makes text like 'align="right"|12.3' safe for display in a table cell,
-- while leaving text like '[[kilogram|kg]]' unchanged.
text = text:gsub('|', '|')
end
if multiline then
end
return text
end
local stats = { pass = 0, fail = 0, ignored = 0 }
Line 104 ⟶ 117:
expected = strip(expected)
local actual = collapse_multiline(run_template(frame, template))
local actual, sbox = status_box(stats, expected, actual)
result:add('|-')
result:add('| ' ..
result:add('| ' ..
result:add('| ' ..
result:add('| ' .. sbox)
end
|