יחידה:LocationAndCountry/בדיקות

מתוך ויקיפדיה, האנציקלופדיה החופשית

ניתן ליצור תיעוד על היחידה הזאת בדף יחידה:LocationAndCountry/בדיקות/תיעוד

-- Unit tests for [[Module:LocationAndCountry]]. Click talk page to run tests.
local p = require('Module:UnitTests')
 
--TODO: update
function p:testSimpleExistingPlace()
    self:preprocess_equals(
    	'{{#invoke:LocationAndCountry|displayFromFrame|P19|Q18545435|P569|1|; }}',
    	'[[בוקרשט]], [[ממלכת רומניה]]'
    )
end
 
function p:testOldCountryNonExistingPlace()
    self:preprocess_equals(
    	'{{#invoke:LocationAndCountry|displayFromFrame|P19|Q57170|P569|1|; }}',
    	'ביבריך, [[הקיסרות הגרמנית]]'
    )
end

--TODO: update
function p:testNoLocalLabel()
    self:preprocess_equals(
    	'{{#invoke:LocationAndCountry|displayFromFrame|P19|Q239998|P569|1|; }}',
    	'[[רוסיה]][[קטגוריה:ויקינתונים:ערכים_חסרי_תווית_בעברית: מקום לידה]][[קטגוריה:ויקינתונים:ערכים_חסרי_תווית_בעברית]]'
    )
end

function p:testOldCountryExistingPlace()
    self:preprocess_equals(
    	'{{#invoke:LocationAndCountry|displayFromFrame|P19|Q57409|P569|1|; }}',
    	'[[דרזדן]], [[הקיסרות הגרמנית]]'
    )
end

function p:testVienna()
    self:preprocess_equals(
    	'{{#invoke:LocationAndCountry|displayFromFrame|P20|Q359705|P570|1|; }}',
    	'[[וינה]], המדינה הפדראלית האוסטרית'
    )
end

--since Jerusalem was part of both Israel and Jordan this is disambigous
function p:testJerusalem1959()
    self:preprocess_equals(
    	'{{#invoke:LocationAndCountry|displayFromFrame|P20|Q2890005|P570|1|; }}',
    	'[[ירושלים]]'
    )
end

--TODO: update
function p:testBestNoTimeClaim()
    self:preprocess_equals(
    	'{{#invoke:LocationAndCountry|displayFromFrame|P19|Q4118657|P569|1|; }}',
    	'[[קהיר]], [[מצרים]]'
    )
end

return p