Jump to content

Module:Disambiguation/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PresN (talk | contribs) at 21:30, 30 August 2023. 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')
	self:preprocess_equals('{{#invoke:Disambiguation | isDisambiguationPage | Beat Up}}', 'yes')
	self:preprocess_equals('{{#invoke:Disambiguation | isDisambiguationPage | Frederick II}}', 'yes')
	self:preprocess_equals('{{#invoke:Disambiguation | isDisambiguationPage | List of peaks named Signal}}', '') -- Set Index Article
	self:preprocess_equals('{{#invoke:Disambiguation | isDisambiguationPage | Abby (The Last of Us)}}', '') -- non-disambiguation page with {{italic disambiguation}} template
end

function p:test_sandbox()
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Paris}}', '')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | New}}', 'yes')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Black swan (disambiguation)}}', 'yes')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Beat Up}}', 'yes')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Frederick II}}', 'yes')
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | List of peaks named Signal}}', '') -- Set Index Article
	self:preprocess_equals('{{#invoke:Disambiguation/sandbox | isDisambiguationPage | Abby (The Last of Us)}}', '') -- non-disambiguation page with {{italic disambiguation}} template
end

return p