Jump to content

Module:Sandbox/Aidan9382/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Aidan9382 (talk | contribs) at 14:33, 28 January 2023 (Undid revision 1136056839 by Aidan9382 (talk) - not needed anymore). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Dummy unit tests

local p = require('Module:UnitTests/sandbox')

-- Fake test

function p:funcNotBegginningTest()
	self:preprocess_equals('<span>[[Example|Function 1]]</span>', '<span>[[Example|Function 1]]</span>')
end

-- Regular tests

function p:test_funcBegginningTest()
	self:preprocess_equals('<span>[[Example|Function 2]]</span>', '<span>[[Example|Function 2]]</span>')
end

function p:test_doomedToFail()
	self:preprocess_equals('<span>[[Example|Function 3]]</span>', '<span>[[Example|Function 4]]</span>')
end

-- nowiki tests

function p:test_funcBegginningTest_nowiki()
	self:preprocess_equals('<span>[[Example|Function 2]]</span>', '<span>[[Example|Function 2]]</span>', {nowiki=true})
end

function p:test_doomedToFail_nowiki()
	self:preprocess_equals('<span>[[Example|Function 3]]</span>', '<span>[[Example|Function 4]]</span>', {nowiki=true})
end

-- combined tests

function p:test_funcBegginningTest_combined()
	self:preprocess_equals('{{safesubst:text|1=<span>[[Example|Function 2]]</span>}}', '<span>[[Example|Function 2]]</span>', {combined=true})
end

function p:test_doomedToFail_combined()
	self:preprocess_equals('<span>[[Example|Function 3]]</span>', '<span>[[Example|Function 4]]</span>', {combined=true})
end

-- finish

return p