2014-03-05 16:30:09 +00:00
|
|
|
|
local testframework = require 'Module:TestFramework'
|
|
|
|
|
|
|
|
|
|
local langs = nil
|
|
|
|
|
local function getLangs()
|
|
|
|
|
if langs == nil then
|
|
|
|
|
langs = {
|
|
|
|
|
mw.language.new( 'en' ),
|
|
|
|
|
mw.language.new( 'kaa' ),
|
|
|
|
|
mw.language.new( 'fa' ),
|
|
|
|
|
mw.language.new( '[[bogus]]' ),
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
return langs
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function test_method( func, ... )
|
|
|
|
|
local langs = getLangs()
|
|
|
|
|
|
|
|
|
|
local ret = {}
|
|
|
|
|
for i = 1, #langs do
|
|
|
|
|
local got = { pcall( langs[i][func], langs[i], ... ) }
|
|
|
|
|
if table.remove( got, 1 ) then
|
|
|
|
|
ret[i] = got
|
|
|
|
|
else
|
|
|
|
|
ret[i] = string.gsub( got[1], '^%S+:%d+: ', '' )
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return unpack( ret )
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function test_method_lang( lang, func, ... )
|
|
|
|
|
local obj = mw.language.new( lang )
|
|
|
|
|
return obj[func]( obj, ... )
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function test_plural( lang )
|
|
|
|
|
local obj = mw.language.new( lang )
|
|
|
|
|
local ret1, ret2 = '', ''
|
|
|
|
|
local ret3, ret4 = '', ''
|
|
|
|
|
for i = 0, 29 do
|
|
|
|
|
ret1 = ret1 .. obj:convertPlural( i, 'a', 'b', 'c', 'd', 'e' )
|
|
|
|
|
ret2 = ret2 .. obj:convertPlural( i, { 'a', 'b', 'c', 'd', 'e' } )
|
|
|
|
|
ret3 = ret3 .. obj:plural( i, 'a', 'b', 'c', 'd', 'e' )
|
|
|
|
|
ret4 = ret4 .. obj:plural( i, { 'a', 'b', 'c', 'd', 'e' } )
|
|
|
|
|
end
|
|
|
|
|
if ret1 ~= ret2 or ret1 ~= ret3 or ret1 ~= ret4 then
|
|
|
|
|
error( "Plural tests don't match:" ..
|
|
|
|
|
" " .. ret1
|
|
|
|
|
" " .. ret2
|
|
|
|
|
" " .. ret3
|
|
|
|
|
" " .. ret4
|
|
|
|
|
)
|
|
|
|
|
end
|
|
|
|
|
return ret1
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function test_multi( func, ... )
|
|
|
|
|
local ret = {}
|
|
|
|
|
for i = 1, select( '#', ... ) do
|
|
|
|
|
ret[i] = func( select( i, ... ) )
|
|
|
|
|
end
|
|
|
|
|
return unpack( ret, 1, select( '#', ... ) )
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function test_fetchLanguageNames( ... )
|
|
|
|
|
local ret = mw.language.fetchLanguageNames( ... )
|
|
|
|
|
if type( ret ) == 'table' then
|
|
|
|
|
return {
|
|
|
|
|
en = ret.en,
|
|
|
|
|
ru = ret.ru,
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return ret
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function test_parseFormattedNumber()
|
|
|
|
|
local langs = getLangs()
|
|
|
|
|
|
|
|
|
|
local ret = {}
|
|
|
|
|
for i = 1, #langs do
|
|
|
|
|
local ok, num = pcall( langs[i].formatNum, langs[i], 123456.78901 )
|
|
|
|
|
local got = { pcall( langs[i].parseFormattedNumber, langs[i], num ) }
|
|
|
|
|
if table.remove( got, 1 ) then
|
|
|
|
|
ret[i] = got
|
|
|
|
|
else
|
|
|
|
|
ret[i] = string.gsub( got[1], '^%S+:%d+: ', '' )
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return unpack( ret )
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return testframework.getTestProvider( {
|
|
|
|
|
{ name = 'fetchLanguageName (en)', func = mw.language.fetchLanguageName,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'en' },
|
|
|
|
|
expect = { 'English' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'fetchLanguageName (ru)', func = mw.language.fetchLanguageName,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'ru' },
|
|
|
|
|
expect = { 'русский' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'fetchLanguageName (en,ru)', func = mw.language.fetchLanguageName,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'en', 'ru' },
|
|
|
|
|
expect = { 'английский' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'fetchLanguageName (ru,en)', func = mw.language.fetchLanguageName,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'ru', 'en' },
|
|
|
|
|
expect = { 'Russian' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'fetchLanguageName ([[bogus]])', func = mw.language.fetchLanguageName,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { '[[bogus]]' },
|
|
|
|
|
expect = { '' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'fetchLanguageName (en,[[bogus]])', func = mw.language.fetchLanguageName,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'en', '[[bogus]]' },
|
|
|
|
|
expect = { 'English' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'fetchLanguageNames ()', func = test_fetchLanguageNames,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = {},
|
|
|
|
|
expect = { { en = 'English', ru = 'русский' } }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'fetchLanguageNames (de)', func = test_fetchLanguageNames,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'de' },
|
|
|
|
|
expect = { { en = 'Englisch', ru = 'Russisch' } }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'fetchLanguageNames ([[bogus]])', func = test_fetchLanguageNames,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { '[[bogus]]' },
|
|
|
|
|
expect = { { en = 'English', ru = 'Russian' } }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'getFallbacksFor', func = test_multi,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { mw.language.getFallbacksFor, 'en', 'de', 'arz', '[[bogus]]' },
|
|
|
|
|
expect = { {}, { 'en' }, { 'ar', 'en' }, {} }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'isKnownLanguageTag', func = test_multi,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { mw.language.isKnownLanguageTag, 'en', 'not-a-real-code', 'extension code', '[[bogus]]' },
|
|
|
|
|
expect = { true, false, false, false }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'isSupportedLanguage', func = test_multi,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { mw.language.isSupportedLanguage, 'en', 'not-a-real-code', 'extension code', '[[bogus]]' },
|
|
|
|
|
expect = { true, false, false, false }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'isValidBuiltInCode', func = test_multi,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { mw.language.isValidBuiltInCode, 'en', 'not-a-real-code', 'extension code', '[[bogus]]' },
|
|
|
|
|
expect = { true, true, false, false }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'isValidCode', func = test_multi,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { mw.language.isValidCode, 'en', 'not-a-real-code', 'extension code', '[[bogus]]' },
|
|
|
|
|
expect = { true, true, true, false }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'mw.language.new', func = test_multi, type = 'ToString',
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { mw.language.new, 'en', 'ru', '[[bogus]]' },
|
|
|
|
|
expect = { 'table', 'table', 'table' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:getCode', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getCode' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'en' },
|
|
|
|
|
{ 'kaa' },
|
|
|
|
|
{ 'fa' },
|
|
|
|
|
{ '[[bogus]]' },
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:getFallbackLanguages', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getFallbackLanguages' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ {} },
|
|
|
|
|
{ { 'kk-latn', 'kk-cyrl', 'en' } },
|
|
|
|
|
{ { 'en' } },
|
|
|
|
|
{ {} },
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:isRTL', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'isRTL' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ false },
|
|
|
|
|
{ false },
|
|
|
|
|
{ true },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:lc', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'lc', 'IX' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'ix' },
|
|
|
|
|
{ 'ix' }, -- Probably not actually right, but it's what LanguageKaa returns
|
|
|
|
|
{ 'ix' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:lcfirst', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'lcfirst', 'IX' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'iX' },
|
|
|
|
|
{ 'ıX' },
|
|
|
|
|
{ 'iX' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:uc', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'uc', 'ix' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'IX' },
|
|
|
|
|
{ 'IX' }, -- Probably not actually right, but it's what LanguageKaa returns
|
|
|
|
|
{ 'IX' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:ucfirst', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'ucfirst', 'ix' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'Ix' },
|
|
|
|
|
{ 'İx' },
|
|
|
|
|
{ 'Ix' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:caseFold', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'caseFold', 'ix' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'IX' },
|
|
|
|
|
{ 'IX' }, -- Probably not actually right, but it's what LanguageKaa returns
|
|
|
|
|
{ 'IX' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:formatNum', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'formatNum', 123456.78901 },
|
|
|
|
|
expect = {
|
|
|
|
|
{ '123,456.78901' },
|
|
|
|
|
{ "123\194\160456,78901" },
|
|
|
|
|
{ '۱۲۳٬۴۵۶٫۷۸۹۰۱' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:formatDate', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'formatDate', 'Y-F-d H:i:s', '20140305123456' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ '2014-March-05 12:34:56' },
|
|
|
|
|
{ '2014-Mart-05 12:34:56' },
|
|
|
|
|
{ '۲۰۱۴-مارس-۰۵ ۱۲:۳۴:۵۶' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:formatDuration', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'formatDuration', 86461 },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "1 day, 1 minute and 1 second" },
|
|
|
|
|
{ "1 күн, 1 минут ha'm 1 секунд" },
|
|
|
|
|
{ "۱ روز، ۱ دقیقه و ۱ ثانیه" },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:formatDuration (hours and minutes)', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'formatDuration', 86461, { 'hours', 'minutes' } },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "24 hours and 1 minute" },
|
|
|
|
|
{ "24 сағат ha'm 1 минут" },
|
|
|
|
|
{ "۲۴ ساعت و ۱ دقیقه" },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:parseFormattedNumber', func = test_parseFormattedNumber,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = {},
|
|
|
|
|
expect = {
|
|
|
|
|
{ 123456.78901 },
|
|
|
|
|
{ 123456.78901 },
|
|
|
|
|
{ 123456.78901 },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:convertPlural (en)', func = test_plural,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'en' },
|
|
|
|
|
expect = { 'babbbbbbbbbbbbbbbbbbbbbbbbbbbb' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:convertPlural (pl)', func = test_plural,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'pl' },
|
|
|
|
|
expect = { 'cabbbcccccccccccccccccbbbccccc' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:convertPlural (bogus)', func = test_plural,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { '[[bogus]]' },
|
|
|
|
|
expect = "language code '[[bogus]]' is invalid",
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:convertGrammar (ru)', func = test_method_lang,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'ru', 'convertGrammar', '**ия', 'genitive' },
|
|
|
|
|
expect = { '**ии' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:convertGrammar (bogus)', func = test_method_lang,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { '[[bogus]]', 'convertGrammar', '**ия', 'genitive' },
|
|
|
|
|
expect = "language code '[[bogus]]' is invalid",
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:grammar (ru)', func = test_method_lang,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'ru', 'grammar', 'genitive', '**ия' },
|
|
|
|
|
expect = { '**ии' }
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:grammar (bogus)', func = test_method_lang,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { '[[bogus]]', 'grammar', 'genitive', '**ия' },
|
|
|
|
|
expect = "language code '[[bogus]]' is invalid",
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:gender (male)', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'gender', 'male', 'masculine', 'feminine', 'neutral' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'masculine' },
|
|
|
|
|
{ 'masculine' },
|
|
|
|
|
{ 'masculine' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:gender (female)', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'gender', 'female', 'masculine', 'feminine', 'neutral' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'feminine' },
|
|
|
|
|
{ 'feminine' },
|
|
|
|
|
{ 'feminine' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:gender (male, with sequence)', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'gender', 'male', { 'masculine', 'feminine', 'neutral' } },
|
|
|
|
|
expect = {
|
|
|
|
|
{ 'masculine' },
|
|
|
|
|
{ 'masculine' },
|
|
|
|
|
{ 'masculine' },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:getArrow (forward)', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getArrow', 'forwards' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "→" },
|
|
|
|
|
{ "→" },
|
|
|
|
|
{ "←" },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:getArrow (right)', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getArrow', 'right' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "→" },
|
|
|
|
|
{ "→" },
|
|
|
|
|
{ "→" },
|
|
|
|
|
{ "→" },
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:getDir', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getDir' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "ltr" },
|
|
|
|
|
{ "ltr" },
|
|
|
|
|
{ "rtl" },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:getDirMark', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getDirMark' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "\226\128\142" },
|
|
|
|
|
{ "\226\128\142" },
|
|
|
|
|
{ "\226\128\143" },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:getDirMark opposite', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getDirMark', true },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "\226\128\143" },
|
|
|
|
|
{ "\226\128\143" },
|
|
|
|
|
{ "\226\128\142" },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:getDirMarkEntity', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getDirMarkEntity' },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "‎" },
|
|
|
|
|
{ "‎" },
|
|
|
|
|
{ "‏" },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:getDirMarkEntity opposite', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getDirMarkEntity', true },
|
|
|
|
|
expect = {
|
|
|
|
|
{ "‏" },
|
|
|
|
|
{ "‏" },
|
|
|
|
|
{ "‎" },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{ name = 'lang:getDurationIntervals', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getDurationIntervals', 86461 },
|
|
|
|
|
expect = {
|
|
|
|
|
{ { days = 1, minutes = 1, seconds = 1 } },
|
|
|
|
|
{ { days = 1, minutes = 1, seconds = 1 } },
|
|
|
|
|
{ { days = 1, minutes = 1, seconds = 1 } },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
{ name = 'lang:getDurationIntervals (hours and minutes)', func = test_method,
|
2020-10-23 15:39:12 +00:00
|
|
|
|
args = { 'getDurationIntervals', 86461, { 'hours', 'minutes' } },
|
|
|
|
|
expect = {
|
|
|
|
|
{ { hours = 24, minutes = 1 } },
|
|
|
|
|
{ { hours = 24, minutes = 1 } },
|
|
|
|
|
{ { hours = 24, minutes = 1 } },
|
|
|
|
|
"language code '[[bogus]]' is invalid",
|
|
|
|
|
}
|
2014-03-05 16:30:09 +00:00
|
|
|
|
},
|
|
|
|
|
} )
|