Module:Template test case: Difference between revisions

move the render methods table to the base of the TestCase class
(move Template.outputEquals to the TestCase class)
(move the render methods table to the base of the TestCase class)
Line 127:
local TestCase = {}
TestCase.__index = TestCase
 
TestCase.renderMethods = {
-- Keys in this table are values of the "format" option, values are the
-- method for rendering that format.
columns = 'renderColumns',
rows = 'renderRows',
default = 'renderDefault'
}
 
function TestCase.new(invocationObj, options, cfg)
Line 342 ⟶ 350:
 
function TestCase:__tostring()
local methods = {
collapsed = 'renderCollapsed',
columns = 'renderColumns',
rows = 'renderRows'
}
local format = self.options.format
local method = format and methodsTestCase.renderMethods[format] or 'renderDefault'
local ret = self[method](self)
if self.options.collapsible then