Jump to content

Module:LangSwitch/testcases

Wikibooks වෙතින්
-- Unit tests for [[Module:LangSwitch]]. Click talk page to run tests.
local p = require('Module:UnitTests')

function p:test_langSwitch_without_default()
    self:preprocess_equals_many('{{#invoke:LangSwitch | langSwitch | en = English | co = Corsu | lang = ', '}}', {{'en', 'English'},  {'fr', 'English'}, {'co', 'Corsu'}})
    self:preprocess_equals_many('{{#invoke:LangSwitch | langSwitch | en = English | de = German | lang = ', '}}', {{'en', 'English'},  {'de', 'German'},  {'gsw', 'German'}})
    self:preprocess_equals_many ('{{#invoke:LangSwitch | langSwitch | en = English | gsw = Alemanic | lang = ', '}}', {{'en', 'English'},  {'de', 'English'},  {'gsw', 'Alemanic'}})
end

function p:test_langSwitch_with_default()
    self:preprocess_equals_many('{{#invoke:LangSwitch | langSwitch | it = Italian | default = default | lang = ', '}}', {{'en', 'default'},  {'it', 'Italian'}, {'co', 'Italian'}})
    self:preprocess_equals_many('{{#invoke:LangSwitch | langSwitch | en = English | co = Corsu | default = default | lang = ', '}}', {{'en', 'English'},  {'it', 'default'}, {'co', 'Corsu'}})
    self:preprocess_equals_many('{{#invoke:LangSwitch | langSwitch | en = ~ | it = Italian | default = default | lang = ', '}}', {{'en', ''},  {'it', 'Italian'}, {'co', 'Italian'}})
    self:preprocess_equals_many('{{#invoke:LangSwitch | langSwitch | en = English | it = ~| co = Corsu | default = default | lang = ', '}}', {{'en', 'English'},  {'it', ''}, {'co', 'Corsu'}})
    self:preprocess_equals_many('{{#invoke:LangSwitch | langSwitch | en = English | it = | co = Corsu | default = default | lang = ', '}}', {{'en', 'English'},  {'it', 'default'}, {'co', 'Corsu'}})
end

return p
"https://si.wikibooks.org/w/index.php?title=Module:LangSwitch/testcases&oldid=23862" වෙතින් සම්ප්‍රවේශනය කෙරිණි