Difference between revisions of "Module:Sort title/testcases"
Jump to navigation
Jump to search
blackwiki>Gonnym |
m (15 revisions imported) |
||
| (8 intermediate revisions by one other user not shown) | |||
| Line 2: | Line 2: | ||
local p = require('Module:UnitTests') | local p = require('Module:UnitTests') | ||
| − | function p: | + | function p:test_1_1_titles_live() |
self:preprocess_equals_many('{{#invoke:Sort title|testcases|', '}}', { | self:preprocess_equals_many('{{#invoke:Sort title|testcases|', '}}', { | ||
{'Lost', "Lost"}, | {'Lost', "Lost"}, | ||
| Line 14: | Line 14: | ||
{'4,722 Hours', "4722 Hours"}, | {'4,722 Hours', "4722 Hours"}, | ||
{'4,722 Hours (Agents of S.H.I.E.L.D.)', "4722 Hours (Agents of S.H.I.E.L.D.)"}, | {'4,722 Hours (Agents of S.H.I.E.L.D.)', "4722 Hours (Agents of S.H.I.E.L.D.)"}, | ||
| − | |||
| − | |||
}) | }) | ||
end | end | ||
| − | function p: | + | function p:test_1_2_titles_sandbox() |
self:preprocess_equals_many('{{#invoke:Sort title/sandbox|testcases|', '}}', { | self:preprocess_equals_many('{{#invoke:Sort title/sandbox|testcases|', '}}', { | ||
{'Lost', "Lost"}, | {'Lost', "Lost"}, | ||
| Line 31: | Line 29: | ||
{'4,722 Hours', "4722 Hours"}, | {'4,722 Hours', "4722 Hours"}, | ||
{'4,722 Hours (Agents of S.H.I.E.L.D.)', "4722 Hours (Agents of S.H.I.E.L.D.)"}, | {'4,722 Hours (Agents of S.H.I.E.L.D.)', "4722 Hours (Agents of S.H.I.E.L.D.)"}, | ||
| + | }) | ||
| + | end | ||
| + | |||
| + | function p:test_2_1_special_characters_live() | ||
| + | self:preprocess_equals_many('{{#invoke:Sort title|testcases|', '}}', { | ||
| + | {'A', "A"}, | ||
| + | {'An', "An"}, | ||
| + | {'The', "The"}, | ||
| + | {'A (Dab)', "A (Dab)"}, | ||
| + | {'A (A)', "A (A)"}, | ||
| + | {'A Title', "Title, A"}, | ||
| + | {'A Title (Dab)', "Title, A (Dab)"}, | ||
| + | {'A Title (A Dab)', "Title, A (Dab, A)"}, | ||
| + | {'Title (Dab)', "Title (Dab)"}, | ||
| + | {'Title (A Dab)', "Title (Dab, A)"}, | ||
| + | {'The Title', "Title, The"}, | ||
| + | {'An Egg', "Egg, An"}, | ||
{'A. B. and C.', "A. B. and C."}, | {'A. B. and C.', "A. B. and C."}, | ||
| − | {'A (The | + | {'\'A\' Title', "\'A\' Title"}, |
| + | {'A, My Name', "A, My Name"}, | ||
| + | {'...Title', "...Title"}, | ||
| + | {'...A Title', "...A Title"}, | ||
| + | {'4,722 Hours', "4722 Hours"} | ||
| + | }) | ||
| + | end | ||
| + | |||
| + | function p:test_2_2_special_characters_sandbox() | ||
| + | self:preprocess_equals_many('{{#invoke:Sort title/sandbox|testcases|', '}}', { | ||
| + | {'A', "A"}, | ||
| + | {'An', "An"}, | ||
| + | {'The', "The"}, | ||
| + | {'A (Dab)', "A (Dab)"}, | ||
| + | {'A (A)', "A (A)"}, | ||
| + | {'A Title', "Title, A"}, | ||
| + | {'A Title (Dab)', "Title, A (Dab)"}, | ||
| + | {'A Title (A Dab)', "Title, A (Dab, A)"}, | ||
| + | {'Title (Dab)', "Title (Dab)"}, | ||
| + | {'Title (A Dab)', "Title (Dab, A)"}, | ||
| + | {'The Title', "Title, The"}, | ||
| + | {'An Egg', "Egg, An"}, | ||
| + | {'A. B. and C.', "A. B. and C."}, | ||
| + | {'\'A\' Title', "\'A\' Title"}, | ||
| + | {'A, My Name', "A, My Name"}, | ||
| + | {'...Title', "...Title"}, | ||
| + | {'...A Title', "...A Title"}, | ||
| + | {'4,722 Hours', "4722 Hours"} | ||
| + | }) | ||
| + | end | ||
| + | |||
| + | --[[ | ||
| + | function p:test_3_1_roman_live() | ||
| + | self:preprocess_equals_many('{{#invoke:Sort title|testcases|', '}}', { | ||
| + | {'Treehouse of Horror', "Treehouse of Horror"}, | ||
| + | {'Treehouse of Horror 6', "Treehouse of Horror 6"}, | ||
| + | {'The Treehouse of Horror VI', "Treehouse of Horror 6, The"}, | ||
| + | {'Words with abbreviation I.V.Not.roman.', "Words with abbreviation I.V.Not.roman."}, | ||
| + | {'Words with abbreviation S.H.I.E.L', "Words with abbreviation S.H.I.E.L"}, | ||
| + | {'Treehouse of Horror I', "Treehouse of Horror 1"}, | ||
| + | {'Treehouse of Horror II', "Treehouse of Horror 2"}, | ||
| + | {'Treehouse of Horror III', "Treehouse of Horror 3"}, | ||
| + | {'Treehouse of Horror IV', "Treehouse of Horror 4"}, | ||
| + | {'Treehouse of Horror V', "Treehouse of Horror 5"}, | ||
| + | {'Treehouse of Horror VI', "Treehouse of Horror 6"}, | ||
| + | {'Treehouse of Horror VII', "Treehouse of Horror 7"}, | ||
| + | {'Treehouse of Horror VIII', "Treehouse of Horror 8"}, | ||
| + | {'Treehouse of Horror IX', "Treehouse of Horror 9"}, | ||
| + | {'Treehouse of Horror X', "Treehouse of Horror 10"}, | ||
| + | {'Treehouse of Horror XI', "Treehouse of Horror 11"}, | ||
| + | {'Treehouse of Horror XII', "Treehouse of Horror 12"}, | ||
| + | {'Treehouse of Horror XIII', "Treehouse of Horror 13"}, | ||
| + | {'Treehouse of Horror XIV', "Treehouse of Horror 14"}, | ||
| + | {'Treehouse of Horror XV', "Treehouse of Horror 15"}, | ||
| + | {'Treehouse of Horror XVI', "Treehouse of Horror 16"}, | ||
| + | {'Treehouse of Horror XVII', "Treehouse of Horror 17"}, | ||
| + | {'Treehouse of Horror XVIII', "Treehouse of Horror 18"}, | ||
| + | {'Treehouse of Horror XIX', "Treehouse of Horror 19"}, | ||
| + | {'Treehouse of Horror XX', "Treehouse of Horror 20"} | ||
| + | }) | ||
| + | end--]] | ||
| + | |||
| + | function p:test_3_2_roman_sandbox() | ||
| + | self:preprocess_equals_many('{{#invoke:Sort title/sandbox|testcases|', '}}', { | ||
| + | {'Treehouse of Horror', "Treehouse of Horror"}, | ||
| + | {'Treehouse of Horror 6', "Treehouse of Horror 6"}, | ||
| + | {'The Treehouse of Horror VI', "Treehouse of Horror 6, The"}, | ||
| + | {'Words with abbreviation I.V.Not.roman.', "Words with abbreviation I.V.Not.roman."}, | ||
| + | {'Words with abbreviation S.H.I.E.L', "Words with abbreviation S.H.I.E.L"}, | ||
| + | {'Treehouse of Horror I', "Treehouse of Horror 1"}, | ||
| + | {'Treehouse of Horror II', "Treehouse of Horror 2"}, | ||
| + | {'Treehouse of Horror III', "Treehouse of Horror 3"}, | ||
| + | {'Treehouse of Horror IV', "Treehouse of Horror 4"}, | ||
| + | {'Treehouse of Horror V', "Treehouse of Horror 5"}, | ||
| + | {'Treehouse of Horror VI', "Treehouse of Horror 6"}, | ||
| + | {'Treehouse of Horror VII', "Treehouse of Horror 7"}, | ||
| + | {'Treehouse of Horror VIII', "Treehouse of Horror 8"}, | ||
| + | {'Treehouse of Horror IX', "Treehouse of Horror 9"}, | ||
| + | {'Treehouse of Horror X', "Treehouse of Horror 10"}, | ||
| + | {'Treehouse of Horror XI', "Treehouse of Horror 11"}, | ||
| + | {'Treehouse of Horror XII', "Treehouse of Horror 12"}, | ||
| + | {'Treehouse of Horror XIII', "Treehouse of Horror 13"}, | ||
| + | {'Treehouse of Horror XIV', "Treehouse of Horror 14"}, | ||
| + | {'Treehouse of Horror XV', "Treehouse of Horror 15"}, | ||
| + | {'Treehouse of Horror XVI', "Treehouse of Horror 16"}, | ||
| + | {'Treehouse of Horror XVII', "Treehouse of Horror 17"}, | ||
| + | {'Treehouse of Horror XVIII', "Treehouse of Horror 18"}, | ||
| + | {'Treehouse of Horror XIX', "Treehouse of Horror 19"}, | ||
| + | {'Treehouse of Horror XX', "Treehouse of Horror 20"}, | ||
| + | {'7:15 A.M.', "7:15 A.M."}, | ||
| + | {'The House of L', "House of L, The"}, | ||
}) | }) | ||
end | end | ||
return p | return p | ||
Latest revision as of 07:28, 28 September 2020
Documentation for this module may be created at Module:Sort title/testcases/doc
-- Unit tests for [[Module:Sort title]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_1_1_titles_live()
self:preprocess_equals_many('{{#invoke:Sort title|testcases|', '}}', {
{'Lost', "Lost"},
{'Lost (TV series)', "Lost (TV series)"},
{'Lost (2004 TV series)', "Lost (2004 TV series)"},
{'Lost (American TV series)', "Lost (American TV series)"},
{'The Flash', "Flash, The"},
{'The Flash (TV series)', "Flash, The (TV series)"},
{'Pilot (The Flash)', "Pilot (Flash, The)"},
{'The Trap (The Flash)', "Trap, The (Flash, The)"},
{'4,722 Hours', "4722 Hours"},
{'4,722 Hours (Agents of S.H.I.E.L.D.)', "4722 Hours (Agents of S.H.I.E.L.D.)"},
})
end
function p:test_1_2_titles_sandbox()
self:preprocess_equals_many('{{#invoke:Sort title/sandbox|testcases|', '}}', {
{'Lost', "Lost"},
{'Lost (TV series)', "Lost (TV series)"},
{'Lost (2004 TV series)', "Lost (2004 TV series)"},
{'Lost (American TV series)', "Lost (American TV series)"},
{'The Flash', "Flash, The"},
{'The Flash (TV series)', "Flash, The (TV series)"},
{'Pilot (The Flash)', "Pilot (Flash, The)"},
{'The Trap (The Flash)', "Trap, The (Flash, The)"},
{'4,722 Hours', "4722 Hours"},
{'4,722 Hours (Agents of S.H.I.E.L.D.)', "4722 Hours (Agents of S.H.I.E.L.D.)"},
})
end
function p:test_2_1_special_characters_live()
self:preprocess_equals_many('{{#invoke:Sort title|testcases|', '}}', {
{'A', "A"},
{'An', "An"},
{'The', "The"},
{'A (Dab)', "A (Dab)"},
{'A (A)', "A (A)"},
{'A Title', "Title, A"},
{'A Title (Dab)', "Title, A (Dab)"},
{'A Title (A Dab)', "Title, A (Dab, A)"},
{'Title (Dab)', "Title (Dab)"},
{'Title (A Dab)', "Title (Dab, A)"},
{'The Title', "Title, The"},
{'An Egg', "Egg, An"},
{'A. B. and C.', "A. B. and C."},
{'\'A\' Title', "\'A\' Title"},
{'A, My Name', "A, My Name"},
{'...Title', "...Title"},
{'...A Title', "...A Title"},
{'4,722 Hours', "4722 Hours"}
})
end
function p:test_2_2_special_characters_sandbox()
self:preprocess_equals_many('{{#invoke:Sort title/sandbox|testcases|', '}}', {
{'A', "A"},
{'An', "An"},
{'The', "The"},
{'A (Dab)', "A (Dab)"},
{'A (A)', "A (A)"},
{'A Title', "Title, A"},
{'A Title (Dab)', "Title, A (Dab)"},
{'A Title (A Dab)', "Title, A (Dab, A)"},
{'Title (Dab)', "Title (Dab)"},
{'Title (A Dab)', "Title (Dab, A)"},
{'The Title', "Title, The"},
{'An Egg', "Egg, An"},
{'A. B. and C.', "A. B. and C."},
{'\'A\' Title', "\'A\' Title"},
{'A, My Name', "A, My Name"},
{'...Title', "...Title"},
{'...A Title', "...A Title"},
{'4,722 Hours', "4722 Hours"}
})
end
--[[
function p:test_3_1_roman_live()
self:preprocess_equals_many('{{#invoke:Sort title|testcases|', '}}', {
{'Treehouse of Horror', "Treehouse of Horror"},
{'Treehouse of Horror 6', "Treehouse of Horror 6"},
{'The Treehouse of Horror VI', "Treehouse of Horror 6, The"},
{'Words with abbreviation I.V.Not.roman.', "Words with abbreviation I.V.Not.roman."},
{'Words with abbreviation S.H.I.E.L', "Words with abbreviation S.H.I.E.L"},
{'Treehouse of Horror I', "Treehouse of Horror 1"},
{'Treehouse of Horror II', "Treehouse of Horror 2"},
{'Treehouse of Horror III', "Treehouse of Horror 3"},
{'Treehouse of Horror IV', "Treehouse of Horror 4"},
{'Treehouse of Horror V', "Treehouse of Horror 5"},
{'Treehouse of Horror VI', "Treehouse of Horror 6"},
{'Treehouse of Horror VII', "Treehouse of Horror 7"},
{'Treehouse of Horror VIII', "Treehouse of Horror 8"},
{'Treehouse of Horror IX', "Treehouse of Horror 9"},
{'Treehouse of Horror X', "Treehouse of Horror 10"},
{'Treehouse of Horror XI', "Treehouse of Horror 11"},
{'Treehouse of Horror XII', "Treehouse of Horror 12"},
{'Treehouse of Horror XIII', "Treehouse of Horror 13"},
{'Treehouse of Horror XIV', "Treehouse of Horror 14"},
{'Treehouse of Horror XV', "Treehouse of Horror 15"},
{'Treehouse of Horror XVI', "Treehouse of Horror 16"},
{'Treehouse of Horror XVII', "Treehouse of Horror 17"},
{'Treehouse of Horror XVIII', "Treehouse of Horror 18"},
{'Treehouse of Horror XIX', "Treehouse of Horror 19"},
{'Treehouse of Horror XX', "Treehouse of Horror 20"}
})
end--]]
function p:test_3_2_roman_sandbox()
self:preprocess_equals_many('{{#invoke:Sort title/sandbox|testcases|', '}}', {
{'Treehouse of Horror', "Treehouse of Horror"},
{'Treehouse of Horror 6', "Treehouse of Horror 6"},
{'The Treehouse of Horror VI', "Treehouse of Horror 6, The"},
{'Words with abbreviation I.V.Not.roman.', "Words with abbreviation I.V.Not.roman."},
{'Words with abbreviation S.H.I.E.L', "Words with abbreviation S.H.I.E.L"},
{'Treehouse of Horror I', "Treehouse of Horror 1"},
{'Treehouse of Horror II', "Treehouse of Horror 2"},
{'Treehouse of Horror III', "Treehouse of Horror 3"},
{'Treehouse of Horror IV', "Treehouse of Horror 4"},
{'Treehouse of Horror V', "Treehouse of Horror 5"},
{'Treehouse of Horror VI', "Treehouse of Horror 6"},
{'Treehouse of Horror VII', "Treehouse of Horror 7"},
{'Treehouse of Horror VIII', "Treehouse of Horror 8"},
{'Treehouse of Horror IX', "Treehouse of Horror 9"},
{'Treehouse of Horror X', "Treehouse of Horror 10"},
{'Treehouse of Horror XI', "Treehouse of Horror 11"},
{'Treehouse of Horror XII', "Treehouse of Horror 12"},
{'Treehouse of Horror XIII', "Treehouse of Horror 13"},
{'Treehouse of Horror XIV', "Treehouse of Horror 14"},
{'Treehouse of Horror XV', "Treehouse of Horror 15"},
{'Treehouse of Horror XVI', "Treehouse of Horror 16"},
{'Treehouse of Horror XVII', "Treehouse of Horror 17"},
{'Treehouse of Horror XVIII', "Treehouse of Horror 18"},
{'Treehouse of Horror XIX', "Treehouse of Horror 19"},
{'Treehouse of Horror XX', "Treehouse of Horror 20"},
{'7:15 A.M.', "7:15 A.M."},
{'The House of L', "House of L, The"},
})
end
return p