Module:Television episode redirect handler/testcases

-- Unit tests for Module:Television episode redirect handler. Click talk page to run tests. local p = require('Module:UnitTests')

function p:test_01_1_redirect_categories_live self:preprocess_equals_many('', {		{"series_name=Arrow (TV series)|season_num=5|episode_num=6", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"restricted=yes", "R from television episode, R restricted, R to anchor 2, R with possibilities, R printworthy"},				{"birth_name=yes", "R from television episode, R from birth name, R to anchor 2, R printworthy"},		{"alt_name=yes", "R from television episode, R from alternative name, R to anchor 2, R printworthy"},		{"former_name=yes", "R from television episode, R from former name, R to anchor 2, R printworthy"},		{"short_name=yes", "R from television episode, R from short name, R to anchor 2, R printworthy"},		{"long_name=yes", "R from television episode, R from long name, R to anchor 2, R printworthy"},		{"title_name=yes", "R from television episode, R from name with title, R to anchor 2, R unprintworthy"}, {"alt_spelling=yes", "R from television episode, R from alternative spelling, R to anchor 2, R unprintworthy"}, {"to_diacritic=yes", "R from television episode, R to diacritic, R to anchor 2, R unprintworthy"}, {"incorrect_name=yes", "R from television episode, R from incorrect name, R to anchor 2, R unprintworthy"}, {"capitalisation=yes", "R from television episode, R from miscapitalisation, R to anchor 2, R unprintworthy"}, {"unneeded_dab=yes", "R from television episode, R from unnecessary disambiguation, R to anchor 2, R unprintworthy"}, {"primary=yes", "R from television episode, R to anchor 2, R avoided double redirect, R printworthy"}, {"merge=yes", "R from television episode, R to anchor 2, R from merge, R with possibilities, R printworthy"}, {"history=yes", "R from television episode, R to anchor 2, R with history, R with possibilities, R printworthy"}, {"draft_move=yes", "R from television episode, R from move, R from drafts, R to anchor 2, R unprintworthy"}, }) end

function p:test_01_2_redirect_categories_sandbox self:preprocess_equals_many('', {		{"series_name=Arrow (TV series)|season_num=5|episode_num=6", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"restricted=yes", "R from television episode, R restricted, R to anchor 2, R with possibilities, R printworthy"},				{"birth_name=yes", "R from television episode, R from birth name, R to anchor 2, R printworthy"},		{"alt_name=yes", "R from television episode, R from alternative name, R to anchor 2, R printworthy"},		{"former_name=yes", "R from television episode, R from former name, R to anchor 2, R printworthy"},		{"short_name=yes", "R from television episode, R from short name, R to anchor 2, R printworthy"},		{"long_name=yes", "R from television episode, R from long name, R to anchor 2, R printworthy"},		{"title_name=yes", "R from television episode, R from name with title, R to anchor 2, R unprintworthy"}, {"alt_spelling=yes", "R from television episode, R from alternative spelling, R to anchor 2, R unprintworthy"}, {"to_diacritic=yes", "R from television episode, R to diacritic, R to anchor 2, R unprintworthy"}, {"incorrect_name=yes", "R from television episode, R from incorrect name, R to anchor 2, R unprintworthy"}, {"capitalisation=yes", "R from television episode, R from miscapitalisation, R to anchor 2, R unprintworthy"}, {"unneeded_dab=yes", "R from television episode, R from unnecessary disambiguation, R to anchor 2, R unprintworthy"}, {"primary=yes", "R from television episode, R to anchor 2, R avoided double redirect, R printworthy"}, {"merge=yes", "R from television episode, R to anchor 2, R from merge, R with possibilities, R printworthy"}, {"history=yes", "R from television episode, R to anchor 2, R with history, R with possibilities, R printworthy"}, {"draft_move=yes", "R from television episode, R from move, R from drafts, R to anchor 2, R unprintworthy"}, }) end

function p:test_02_1_title_handling_live self:preprocess_equals_many('', {		{"test_title=Guilty", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"test_title=Guilty (episode)", "R from television episode, R from incorrect disambiguation, R to anchor 2, R unprintworthy"},		{"test_title=Guilty (Arrow)|correct_disambiguation=Arrow", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"test_title=Guilty (Arrow episode)|correct_disambiguation=Arrow", "R from television episode, R to anchor 2, R with possibilities, R printworthy"}, }) end

function p:test_02_2_title_handling_sandbox self:preprocess_equals_many('', {		{"test_title=Guilty", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"test_title=Guilty (episode)", "R from television episode, R from incorrect disambiguation, R to anchor 2, R unprintworthy"},		{"test_title=Guilty (Arrow)|correct_disambiguation=Arrow", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"test_title=Guilty (Arrow episode)|correct_disambiguation=Arrow", "R from television episode, R to anchor 2, R with possibilities, R printworthy"}, }) end

function p:test_03_1_title_section_handling_live self:preprocess_equals_many('', {		{"", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"anchor=yes", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"section=test", "R from television episode, R to section, R with possibilities, R printworthy"},		{"list=test", "R from television episode, R to list entry, R with possibilities, R printworthy"},		{"to_article=test", "R from television episode, R with possibilities, R printworthy"}, }) end

function p:test_03_2_title_section_handling_sandbox self:preprocess_equals_many('', {		{"", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"anchor=yes", "R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"section=test", "R from television episode, R to section, R with possibilities, R printworthy"},		{"list=test", "R from television episode, R to list entry, R with possibilities, R printworthy"},		{"to_article=test", "R from television episode, R with possibilities, R printworthy"}, }) end

function p:test_04_1_multi_series_live self:preprocess_equals_many('', {		{"series_name=Arrow (TV series)|series_name2=The Flash (TV series)", "Arrow (TV series), The Flash (TV series), R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"series_name=Arrow (TV series)|series_name2=The Flash (TV series)|series_name3=Supergirl (TV series)", "Arrow (TV series), The Flash (TV series), Supergirl (TV series), R from television episode, R to anchor 2, R with possibilities, R printworthy"},	}) end

function p:test_04_2_multi_series_sandbox self:preprocess_equals_many('', {		{"series_name=Arrow (TV series)|series_name2=The Flash (TV series)", "Arrow (TV series), The Flash (TV series), R from television episode, R to anchor 2, R with possibilities, R printworthy"},		{"series_name=Arrow (TV series)|series_name2=The Flash (TV series)|series_name3=Supergirl (TV series)", "Arrow (TV series), The Flash (TV series), Supergirl (TV series), R from television episode, R to anchor 2, R with possibilities, R printworthy"},	}) end

return p