Jump to content

Module:Disambiguation/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MSGJ (talk | contribs) at 17:34, 15 May 2023 (+1). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Unit tests for [[Module:{{ROOTPAGENAME}}]]. Click talk page to run tests.
local p = require('Module:UnitTests')

-- Example unit test.
function p:test_1()
	self:preprocess_equals('{{#invoke:Disambiguation | isDisambiguationPage | Paris}}', '')
	self:preprocess_equals('{{#invoke:Disambiguation | isDisambiguationPage | New}}', 'yes')
	self:preprocess_equals('{{#invoke:Disambiguation | isDisambiguationPage | Black swan (disambiguation)}}', 'yes')
	
end

function p:test_sandbox()
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Paris}}', '')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | New}}', '2')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Black swan (disambiguation)}}', '1')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Beat Up}}', '3')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Frederick II}}', '2')
end

return p