Jump to content

Module:Template test case: Difference between revisions

make a start on the exports
(add getInvocation and getOutput methods for the TableInvocation class)
(make a start on the exports)
Line 187: Line 187:
-- Exports
-- Exports
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
local function getTableArgs(frame, wrappers)
return require('Module:Arguments').getArgs(frame, {
wrappers = wrappers,
valueFunc = function (k, v)
if type(k) == 'string' and k:find('^_') then
v = mw.text.trim(v)
if v ~= '' then
return v
end
else
return v
end
end
})
end
local p = {}
function p._table(args)
local invocation = TableInvocation.new(args)
return invocation
end
function p.table(frame)
return p._table(getTableArgs(frame, 'Template:Test case'))
end
function p.columns(frame)
local args = getTableArgs(frame, 'Template:Testcase table')
args._format = 'columns'
return p._table(args)
end
function p.rows(frame)
local args = getTableArgs(frame, 'Template:Testcase rows')
args._format = 'rows'
return p._table(args)
end
function p._exportClasses()
return {
TestCase = TestCase,
Invocation = Invocation,
NowikiInvocation = NowikiInvocation,
TableInvocation = TableInvocation
}
end
return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.