Module:Auto sort/testcases
Appearance
This is the test cases page for the module Module:Auto sort. Results of the test cases. |
local p = require('Module:UnitTests')
local AutoSort = require('Module:Auto sort')
function p:test_normalTitles()
local cases = {
-- empty str
{ '', '' },
-- no article
{ 'Foo', 'Foo' },
-- simple articles
{ 'A Foo', 'Foo, A' },
{ 'An Afoo', 'Afoo, An' },
{ 'The Foo', 'Foo, The' },
-- double article
{ 'The A Team', 'A Team, The' },
-- check wor starting "An"
{ 'Analects', 'Analects' },
{ 'The Analects', 'Analects, The' }
}
for _, c in pairs( cases ) do
local title = c[ 1 ]
local expected = c[ 2 ]
local actual = AutoSort.normalTitles( title )
self:equals( title, actual, expected )
end
end
return p