Content deleted Content added
make a template class and add code to set template objects in the test case class |
implement a default test case format |
||
Line 126:
-- Separate general options from options for specific templates
local templateOptions = mTableTools.numData(options, true)
obj.options = templateOptions.other
templateOptions.other = nil▼
-- Make the template objects
Line 141 ⟶ 140:
obj.templates[2] = Template.new(
invocationObj,
function ()
return templateTitleCallback():subPageTitle('sandbox')
Line 154 ⟶ 153:
return obj
end
function TestCase:renderDefault()
local ret = {}
ret[#ret + 1] = self.templates[1]:getInvocation('code')
for i, obj in ipairs(self.templates) do
ret[#ret + 1] = '<div style="clear: both;"></div>'
ret[#ret + 1] = obj:makeBraceLink()
ret[#ret + 1] = obj:getOutput()
end
return table.concat(ret, '\n\n')
end
function TestCase:tostring()
local methods = {
columns = 'renderColumns',
rows = 'renderRows'
}
local format = self.options.format
local method = format and methods[format] or 'renderDefault'
return self[method](self)
end
Line 248 ⟶ 268:
end
end
local
local testCaseObj = TestCase.new(invocationObj, options)
return tostring(testCaseObj)
end
Line 271 ⟶ 292:
function p._nowiki(args)
local
args.invocation = nil
local options = args
local testCaseObj = TestCase.new(invocationObj, options)
return tostring(testCaseObj)
end
|