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 18:07, 21 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_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_sandbox_main()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|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."}
	})
end

function p:test_extended_disamiguation_sandbox_main()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|main|', '}}', {		
		{'Lost (2004 TV series)', "Debug: Using a valid format - true."},
		{'Lost (American TV series)', "Debug: Using a valid format - true."},
		{'Lost (2004 American TV series)', "Debug: Using a valid format - true."},
		{'Lost (American 2004 TV series)', "Debug: Using a valid format - false."},
		{'Lost (U.S. TV series)', "Debug: Using a valid format - false."}
	})
end

function p:test_exception_list_sandbox_main()
	self:preprocess_equals_many('{{#invoke:Infobox television disambiguation check/sandbox|main|', '}}', {		
		{'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

return p