Jump to content

Module:UnitTests/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Ans (talk | contribs) at 12:48, 11 October 2017 (.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Example Unit tests for [[Module:UnitTests]]. Click talk page to run tests.
local p = require('Module:UnitTests')

local frame0 = mw.getCurrentFrame()
local frame0_getTitle = frame0:getTitle()
local getCurrentFrame_getTitle = mw.getCurrentFrame():getTitle()
local arg = ...

function p._test(frame)
    return
		frame:getTitle() .. " " ..
		frame0:getTitle() .. " " ..
		frame0_getTitle .. " " ..
		getCurrentFrame_getTitle .. " " ..
		mw.dumpObject(arg) .. " " ..
		""
end

function p:test()
    self:preprocess_equals('{{#invoke:UnitTests/testcases | _test}}', '')
end

return p