Open main menu

Documentation for this module may be created at Module:City/testcases/doc

-- 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|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|1=', '}}',
		'{{City/old|1=', '}}', {
			{'Q439'},
			{'Burma'},
			{'Zambia'},
			{'Кременець'},
			{'اختر'},
			{'{{London}}'},
			{'{{City|krakau}}'},
			{'[[Wąchock]], Poland'},
			{'[[]]'},
			{'  '},
			{'?'},
	} )
end

function p:test_city_links()
	self:preprocess_equals('{{#invoke:City | city|place=London|lang=en|link=wikidata}}', '[[d:Q84|London]]')
	self:preprocess_equals('{{#invoke:City | city|place=london|lang=en|link=commons}}', '[[London|London]]')
	self:preprocess_equals('{{#invoke:City | city|place=LONDON|lang=en|link=-}}', 'London')
	self:preprocess_equals('{{#invoke:City | city|place=Wąchock|lang=en}}', '[[w:en:Wąchock|Wąchock]]')
	self:preprocess_equals('{{#invoke:City | city|place=Gmina Wąchock|lang=en}}', '[[w:en:Gmina Wąchock|Gmina Wąchock]]')
end


return p