Module:City/sandbox/testcases
Lua
Documentation for this module may be created at Module:City/sandbox/testcases/doc
Code
-- Unit tests for [[Module:Name]] date function. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_city_languages()
self:preprocess_equals_preprocess_many( -- Lua form
'{{#invoke:City/sandbox|city|place=London|lang=', '}}',
'{{London|1=', '}}', {
{'an'},
{'bg'},
{'ca'},
{'cs'},
{'da'},
{'de'},
{'en'},
{'es'},
{'fa'},
{'fr'},
{'fi'},
{'gl'},
{'hr'},
{'hu'},
{'it'},
{'lv'},
{'mk'},
{'nds'},
{'nl'},
{'nb'},
{'nn'},
{'pl'},
{'pt'},
{'ro'},
{'ru'},
{'sh'},
{'sk'},
{'sl'},
{'sr'},
{'sv'},
{'th'},
{'uk'},
} )
end
function p:test_city_places()
self:preprocess_equals_preprocess_many(
'{{City/sandbox|1=', '}}',
'{{City/old|1=', '}}', {
{'Q439'},
{'Burma'},
{'Zambia'},
{'Gmina Wąchock'},
{'Zalew Wąchocki'},
{'Кременець'},
{'اختر'},
{'{{London}}'},
{'{{City|krakau}}'},
{'[[Wąchock]], Poland'},
{'[[]]'},
{' '},
{'?'},
} )
end
function p:test_city_links()
self:preprocess_equals_preprocess('{{#invoke:City/sandbox | city|place=London|lang=en|link=wikidata}}', '{{label|Q84|link=wikidata}}')
self:preprocess_equals_preprocess('{{#invoke:City/sandbox | city|place=london|lang=en|link=commons}}', '{{label|Q84|link=commons}}')
self:preprocess_equals_preprocess('{{#invoke:City/sandbox | city|place=LONDON|lang=en|link=-}}', 'London')
self:preprocess_equals_preprocess('{{#invoke:City/sandbox | city|place=Watermaal-Bosvoorde}}', '{{label|Q272262|link=wikipedia}}')
end
return p