Jump to content

Module:Infobox television disambiguation check/testcases

From Wikipedia, the free encyclopedia
-- Unit tests for [[Module:Infobox television disambiguation check]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_1_general()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television disambiguation check', '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()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television disambiguation check', '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()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television disambiguation check', '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()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television disambiguation check', '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()
	self:preprocess_equals_sandbox_many('{{#invoke:Infobox television disambiguation check', '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