Jump to content

Module:Infobox television disambiguation check/testcases

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Gonnym (talk | contribs) at 10:31, 22 May 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- Example Unit tests for [[Module:Infobox television disambiguation check]]. Click talk page to run tests.
local p = require('Module:UnitTests')
--[[
function p:test_1_main()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check|main|', '}}', {
		{'', "Debug: Error: Empty title.", "Debug: Using a valid format."},
		{'Lost', "Debug: No disambiguation.", "Debug: Using a valid format."},
		{'Lost (TV series)', "Debug: Using a valid format."},
		{'Lost (TV program)', "Debug: Using a valid format."},
		{'Lost (TV programme)', "Debug: Using a valid format."},
		{'Lost (TV film)', "Debug: Using a valid format."},
		{'Lost (film)', "Debug: Using a valid format."},
		{'Lost (miniseries)', "Debug: Using a valid format."},
		{'Lost (serial)', "Debug: Using a valid format."},
		{'Lost (game show)', "Debug: Using a valid format."},
		{'Lost (talk show)', "Debug: Using a valid format."},
		{'Lost (web series)', "Debug: Using a valid format."},
		{'The (206)', "Debug: Title on exception list."},
		{'Cinderella (Apakah Cinta Hanyalah Mimpi?)', "Debug: Title on exception list."},
		{'How to Live with Your Parents (For the Rest of Your Life)', "Debug: Title on exception list."},
		{'I (Almost) Got Away With It', "Debug: Title on exception list."},
		{'Monty Python: Almost the Truth (Lawyers Cut)', "Debug: Title on exception list."},
		{'Randall and Hopkirk (Deceased)', "Debug: Title on exception list."}
	})
end
 --]]

function p:test_1_general_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|main|', '}}', {
		{'test=yes', "Debug: Error: Empty title.", "Debug: Using a valid format."},
		{'Lost|test=yes', "Debug: No disambiguation.", "Debug: Using a valid format."},
		{'Lost (bad disambiguation)|test=yes', "Debug: Not a valid format."},
		{'Lost (soap opera)|test=yes', "Debug: Not a valid format."},
		{'Lost (anime)|test=yes', "Debug: Not a valid format."}
	})
end

function p:test_2_valid_formats_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|main|', '}}', {
		{'Lost (TV series)|test=yes', "Debug: Using a valid format."},
		{'Lost (TV program)|test=yes', "Debug: Using a valid format."},
		{'Lost (TV programme)|test=yes', "Debug: Using a valid format."},
		{'Lost (TV film)|test=yes', "Debug: Using a valid format."},
		{'Lost (film)|test=yes', "Debug: Using a valid format."},
		{'Lost (miniseries)|test=yes', "Debug: Using a valid format."},
		{'Lost (serial)|test=yes', "Debug: Using a valid format."},
		{'Lost (game show)|test=yes', "Debug: Using a valid format."},
		{'Lost (talk show)|test=yes', "Debug: Using a valid format."},
		{'Lost (web series)|test=yes', "Debug: Using a valid format."}
	})
end

function p:test_3_extended_disamiguation_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|main|', '}}', {		
		{'Lost (2004 TV series)|test=yes', "Debug: Using a valid format with an extended Year - valid."},
		{'Lost (200 TV series)|test=yes', "Debug: Using a valid format with an extended Year - invalid."},
		{'Lost (American TV series)|test=yes', "Debug: Using a valid format with an extended Country - valid."},
		{'Lost (U.S. TV series)|test=yes', "Debug: Using a valid format with an extended Country - invalid."},
		{'Lost (2004 American TV series)|test=yes', "Debug: Using a valid format with an extended Year and Country - valid."},
		{'Lost (200 American TV series)|test=yes', "Debug: Using a valid format with an extended Year and Country - invalid."},
		{'Lost (2004 U.S. TV series)|test=yes', "Debug: Using a valid format with an extended Year and Country - invalid."},
		{'Lost (American 2004 TV series)|test=yes', "Debug: Using a valid format but using an incorrect extended style."}
	})
end

function p:test_4_exception_list_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|main|', '}}', {		
		{'The (206)|test=yes', "Debug: Title on exception list."},
		{'Cinderella (Apakah Cinta Hanyalah Mimpi?)|test=yes', "Debug: Title on exception list."},
		{'How to Live with Your Parents (For the Rest of Your Life)|test=yes', "Debug: Title on exception list."},
		{'I (Almost) Got Away With It|test=yes', "Debug: Title on exception list."},
		{'Monty Python: Almost the Truth (Lawyers Cut)|test=yes', "Debug: Title on exception list."},
		{'Randall and Hopkirk (Deceased)|test=yes', "Debug: Title on exception list."}
	})
end

function p:test_5_other_infoboxes_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|main|', '}}', {		
		{'Lost (franchise)|test=yes', "Debug: Using incorrect infobox - franchise."},
		{'Lost (season 1)|test=yes', "Debug: Using incorrect infobox - season."},
		{'Lost (radio TV program)|test=yes', "Debug: Using incorrect infobox - radio."},
	})
end

return p