Module:Template test case: Difference between revisions
(decode lt, gt and quot HTML enties for NowikiInvocation objects, and escape HTML entities in pre tag invocations in Template objects) |
(add a Template.outputEquals function) |
||
Line 23: | Line 23: | ||
getOutput = true | getOutput = true | ||
} | } | ||
function Template.outputEquals(obj1, obj2) | |||
local function normaliseOutput(obj) | |||
local out = obj:getOutput() | |||
-- Remove the random parts from strip markers (see [[Help:Strip markers]]) | |||
out = out:gsub('(%cUNIQ).-(QINU%c)', '%1%2') | |||
return out | |||
end | |||
return normaliseOutput(obj1) == normaliseOutput(obj2) | |||
end | |||
function Template.new(invocationObj, options) | function Template.new(invocationObj, options) | ||
Line 282: | Line 292: | ||
return tostring(root) | return tostring(root) | ||
end | |||
function TestCase:renderCollapsed() | |||
end | end | ||
Line 299: | Line 313: | ||
function TestCase:__tostring() | function TestCase:__tostring() | ||
local methods = { | local methods = { | ||
collapsed = 'renderCollapsed', | |||
columns = 'renderColumns', | columns = 'renderColumns', | ||
rows = 'renderRows' | rows = 'renderRows' | ||
Line 454: | Line 469: | ||
function p._exportClasses() | function p._exportClasses() | ||
return { | return { | ||
Template = Template, | |||
TestCase = TestCase, | TestCase = TestCase, | ||
Invocation = Invocation, | Invocation = Invocation, |