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

function p:test_1_1_general_live()
	self:preprocess_equals_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_1_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_1_valid_formats_live()
	self:preprocess_equals_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_2_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_1_extended_disamiguation_live()
	self:preprocess_equals_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_3_2_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_1_exception_list_live()
	self:preprocess_equals_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_4_2_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_1_other_infoboxes_live()
	self:preprocess_equals_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

function p:test_5_2_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
"https://si.wikipedia.org/w/index.php?title=Module:Infobox_television_disambiguation_check/testcases&oldid=555225" වෙතින් සම්ප්‍රවේශනය කෙරිණි