Module:UnitTests/testcases

-- 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 .. "\n" .. "# " .. frame0:getTitle .. "\n" .. "# " .. frame0_getTitle .. "\n" .. "# " .. getCurrentFrame_getTitle .. "\n" .. "# " .. mw.dumpObject(arg) .. "\n" .. "" end

function p._test0(frame) return "# Module:UnitTests/testcases\n" .. "# Module:UnitTests/testcases\n" .. "# Module:UnitTests/testcases\n" .. "# Module:UnitTests/testcases\n" .. "# nil\n" .. "" end

function p.preprocess(frame) --return frame.args[1] return frame:preprocess(frame.args[1]) end

function p.p1(frame) return frame:preprocess('') end

function p.p2(frame) return frame:preprocess('') end

function p:test local testcases_expected_result = "" .. "# Module:UnitTests/testcases\n" .. "# Module:UnitTests/testcases\n" .. "# Module:UnitTests/testcases\n" .. "# Module:UnitTests/testcases\n" .. ""	self:preprocess_equals('', "\n" ..		testcases_expected_result ..		"# nil\n" ..	"") local testcases_frame_expected_result = "" .. "# Module:UnitTests/testcases/frame\n" .. "# Module:UnitTests/testcases/frame\n" .. "# Module:UnitTests/testcases/frame\n" .. "# Module:UnitTests/testcases/frame\n" .. ""	self:preprocess_equals('', "\n" ..		testcases_frame_expected_result ..		"# nil\n" ..	"") self:equals("&#x3c;nowiki&#x3e;mw.getCurrentFrame:preprocess(  )&#x3c;/nowiki&#x3e;",		mw.getCurrentFrame:preprocess(  ),		"\n" ..		testcases_frame_expected_result ..		"# nil\n" ..	"") self:equals("&#x3c;nowiki&#x3e;frame0:preprocess(  )&#x3c;/nowiki&#x3e;",		frame0:preprocess(  ),		"\n" ..		testcases_frame_expected_result ..		"# nil\n" ..	"") --self:equals("& self:equals("require('Module:UnitTests/testcases/frame')._test(mw.getCurrentFrame)",		"\n"..require('Module:UnitTests/testcases/frame')._test(mw.getCurrentFrame),		"\n" ..		testcases_expected_result ..		'# "Module:UnitTests/testcases/frame"\n' ..	"") self:equals("p._test(frame0)",		"\n"..p._test(frame0),		"\n" ..		testcases_expected_result ..		"# nil\n" ..	"") self:equals("p._test(mw.getCurrentFrame)",		"\n"..p._test(mw.getCurrentFrame),		"\n" ..		testcases_expected_result ..		"# nil\n" ..	"") --self:preprocess_equals('', "\n" ..		testcases_expected_result ..		" end

function p:error1 error("p:error1") end

function p.error2 error("p.error2") end

function p:error3 error("p:error3") end

function p.error3 error("p.error3") end

function p.error4 error("p.error4") end

function p:error4 error("p:error4") end

function p:test_error5 error("p:test_error5") end

function p:_test6 error("p:_test6") end

function p.ttest_error7 error("p.test_error7") end

function p._test8 error("p.test8") end

return p