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 09:34, 7 July 2019. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
-- 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.""},
		{'Lost', "Debug: No disambiguation.""},
		{'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|test|', '}}', {
		{'', "Debug: Error: Empty title."},
		{'Lost', "Debug: No disambiguation."},
		{'Lost (bad disambiguation)', "Debug: Not a valid format."},
		{'Lost (soap opera)', "Debug: Not a valid format."},
		{'Lost (anime)', "Debug: Not a valid format."}
	})
end

function p:test_2_valid_formats_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|test|', '}}', {
		{'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."}
	})
end

function p:test_3_extended_disamiguation_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|test|', '}}', {		
		{'Lost (2004 TV series)', "Debug: Using a valid format with an extended Year - valid."},
		{'Lost (200 TV series)', "Debug: Using a valid format with an extended Year - invalid."},
		{'Lost (American TV series)', "Debug: Using a valid format with an extended Country - valid."},
		{'Lost (U.S. TV series)', "Debug: Using a valid format with an extended Country - invalid."},
		{'Lost (Russian TV series)', "Debug: Using a valid format with an extended Country - valid."},
		{'Lost (2004 American TV series)', "Debug: Using a valid format with an extended Year and Country - valid."},
		{'Lost (200 American TV series)', "Debug: Using a valid format with an extended Year and Country - invalid."},
		{'Lost (2004 U.S. TV series)', "Debug: Using a valid format with an extended Year and Country - invalid."},
		{'Lost (American 2004 TV series)', "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|test|', '}}', {		
		{'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_5_other_infoboxes_sandbox()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|test|', '}}', {		
		{'Lost (franchise)', "Debug: Using incorrect infobox - franchise."},
		{'Lost (season)', "Debug: Using incorrect infobox - season."},
		{'Lost (season 1)', "Debug: Using incorrect infobox - season."},
		{'Lost (series 1)', "Debug: Using incorrect infobox - series d*."},
		{'Lost (series 10)', "Debug: Using incorrect infobox - series d*."},
		{'Lost (series one)', "Debug: Using incorrect infobox - series d*."},
		{'Lost (radio TV program)', "Debug: Using incorrect infobox - radio."},
		{'Lost (TV programming block)', "Debug: Using incorrect infobox - TV programming block."},		
	})
end

return p