Module documentation
[create]
The documentation for this module is missing. Click here to create it.
-- <nowiki>
local p = {}
function p.main(frame)
local args = frame:getParent().args
local title = mw.title.getCurrentTitle()
local typ = string.lower(args[1] or '')
local moduleName, functionName
if typ == 'scrib' then
moduleName = 'Module:' .. (args.modulename or title.rootText) .. '/testcases'
functionName = 'run'
frame.args = {}
elseif typ == 'unittest' then
moduleName = 'Module:' .. (args.modulename or title.rootText) .. '/testcases'
functionName = 'run_tests'
frame.args = {
differs_at = args.differs_at or '1'
}
elseif typ == 'sandbox' then
moduleName = 'Module:Testharness'
functionName = 'run_tests'
frame.args = {
modulename = args.modulename or (title.rootText .. '/sandbox'),
testdata = args.testdata or (title.rootText .. '/sandbox/testcases'),
differs_at = args.differs_at or '1',
display_mode = args.display_mode or '0'
}
else
moduleName = 'Module:Testharness'
functionName = 'run_tests'
frame.args = {
modulename = args.modulename or '',
testdata = args.testdata or '',
differs_at = args.differs_at or '1',
display_mode = args.display_mode or '0'
}
end
return require(moduleName)[functionName](frame)
end
return p