League of Legends Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!
You can even turn off ads in your preferences.

Come join the LoL Wiki community Discord server!

READ MORE

League of Legends Wiki
No edit summary
m (Protected "Module:Testunit": Vandalism potential (‎[edit=autoconfirmed] (indefinite) ‎[move=autoconfirmed] (indefinite)))
 
(No difference)

Latest revision as of 09:54, 22 May 2020

Documentation for this module may be created at Module:Testunit/doc

-- <pre>
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'
        }
    else
        moduleName = 'Dev:Testharness'
        functionName = 'run_tests'
        frame.args = {
            modulename = args.modulename or '',
            testdata = args.testdata or '',
            differs_at = args.differs_at or '1'
        }
    end
 
    return require(moduleName)[functionName](frame)
end
 
return p
-- </pre>
--[[Category:Lua]]