17 teszt sikertelen. (frissítés)

Szöveg Várt Tényleges
testcases for getCategoryName:
Sikertelen en English language angol-magyar szótár
Sikertelen af Afrikaans language afrikaans-magyar szótár
Sikertelen av Avar language avar-magyar szótár
Sikertelen ht Haitian Creole language haiti kreol-magyar szótár
Sikertelen ase American Sign Language amerikai jel-magyar szótár
Szöveg Várt Tényleges
testcases for getFamily:
Sikeres en gmw gmw
Sikeres ht crp crp
Sikeres ase sgn sgn
Szöveg Várt Tényleges
testcases for getNonEtymological:
colspan="4" style="text-align: left" | Parancsfájlhiba tesztelés közben: Modul:languages/testcases:175: attempt to call method 'getNonEtymological' (a nil value)
stack traceback:
	[C]: in function 'getNonEtymological'
	Modul:languages/testcases:175: in function 'func'
	Modul:UnitTests:235: in function 'iterate'
	Modul:languages/testcases:174: in function <Modul:languages/testcases:166>
	(tail call): ?
	[C]: in function 'xpcall'
	Modul:UnitTests:286: in function <Modul:UnitTests:251>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
Szöveg Várt Tényleges
testcases for getOtherNames:
Sikertelen ht {"Creole", "Haitian", "Kreyòl"} {"creole", "haitian", "kreyòl"}
Sikertelen ase {"Ameslan", "ASL"} {"ameslan", "aSL"}
Szöveg Várt Tényleges
testcases for getScriptCodes:
Sikeres en {"Latn", "Brai", "Shaw", "Dsrt"} {"Latn", "Brai", "Shaw", "Dsrt"}
Sikeres ht {"Latn"} {"Latn"}
Sikeres ase {"Sgnw"} {"Sgnw"}
Szöveg Várt Tényleges
testcases for getWikidataItem:
Sikeres en Q1860 Q1860
Sikeres eo Q143 Q143
Sikeres aql-pro Q18389588 Q18389588
Sikeres mkh-ban-pro (nil) (nil)
Szöveg Várt Tényleges
testcases for getWikipediaArticle:
Sikeres en English language English language
Sikeres af Afrikaans Afrikaans
Sikertelen ae Avestan avestan
Sikeres ht Haitian Creole Haitian Creole
Sikeres ase American Sign Language American Sign Language
Sikeres dv Maldivian language Maldivian language
Sikeres eo Esperanto Esperanto
Sikeres goh Old High German Old High German
Szöveg Várt Tényleges
testcases for makeDisplayText:
Sikertelen ஸ்ரீகாகுளம் (tamil, ta) ஶ்ரீகாகுளம் ஸ்ரீகாகுளம்
Szöveg Várt Tényleges
testcases for makeEntryName:
Sikeres hūmānitās (latin, la) humanitas humanitas
Sikeres coëō (latin, la) coeo coeo
Sikeres àzàhàr̃iyyā̀ (hausza, ha) azahariyya azahariyya
Sikeres alas! (angol, en) alas alas
Sikeres ¿cómo te llamas? (spanyol, es) cómo te llamas cómo te llamas
Sikertelen ӓ ё (orosz, ru) а ё ӓ ё
Sikeres ¿ ? (spanyol, es) ¿ ? ¿ ?
Sikeres ¡ ! (spanyol, es) ¡ ! ¡ !
Sikeres mais bien sûr ! (francia, fr) mais bien sûr mais bien sûr
Sikeres ¡ (nemzetközi, mul) ¡ ¡
Sikeres Πηληῐ̈ᾰ́δης (ógörög, grc) Πηληϊάδης Πηληϊάδης
Sikeres العَرَبِيَّة (arab, ar) العربية العربية
Sikeres ٱ (arab, ar) ٱ ٱ
Sikeres ـُ (arab, ar) ـُ ـُ
Sikeres 치〯 (middle korean, okm)
Szöveg Várt Tényleges
testcases for makeSortKey:
diacritic removal
Sikeres Πηληϊάδης Αἶνος (ógörög, grc) ΠΗΛΗΙΑΔΗΣ ΑΙΝΟΣ ΠΗΛΗΙΑΔΗΣ ΑΙΝΟΣ
Sikeres shį́į́dą́ą́ʼ (navahó, nv) SHIIDAA SHIIDAA
dedicated sortkey modules
Sikeres Tuyên ngôn toàn thế giới về nhân quyền của Liên Hợp Quốc (vietnámi, vi) TUYE₂N NGO₂N TOAN1 THE₂4 GIO₃I4 VE₂1 NHA₂N QUYE₂N1 CUA2 LIE₂N HO₃P5 QUO₂C4 TUYE₂N NGO₂N TOAN1 THE₂4 GIO₃I4 VE₂1 NHA₂N QUYE₂N1 CUA2 LIE₂N HO₃P5 QUO₂C4
Sikertelen 命裡有時終須有,命裡無時莫強求 (kínai, zh) 口05衣07月02日06糸05頁03月02,口05衣07火08日06艸07弓08水02 命裡有時終須有,命裡無時莫強求 colspan="4" style="text-align: left" | Parancsfájlhiba tesztelés közben: package.lua:80: module 'Module:zh-sortkey/data/unsupported' not found
stack traceback:
	[C]: ?
	[C]: in function 'error'
	package.lua:80: in function 'load'
	package.lua:99: in function <package.lua:89>
	(tail call): ?
	mw.lua:496: in function 'executeModule'
	mw.lua:768: in function 'loadData'
	Modul:zh-sortkey:181: in function 'makeSortKey'
	Modul:languages:363: in function 'func'
	Modul:languages/testcases:18: in function 'func'
	Modul:UnitTests:235: in function 'iterate'
	Modul:languages/testcases:67: in function <Modul:languages/testcases:54>
	(tail call): ?
	[C]: in function 'xpcall'
	Modul:UnitTests:286: in function <Modul:UnitTests:251>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
Szöveg Várt Tényleges
testcases for makeWikipediaLink:
Sikertelen en [[w:English language|English]] [[w:English language|angol]]
Sikertelen af [[w:Afrikaans|Afrikaans]] [[w:Afrikaans|afrikaans]]
Sikertelen ae [[w:Avestan|Avestan]] [[w:avestan|avesztai]]
Szöveg Várt Tényleges
testcases for toJSON:
colspan="4" style="text-align: left" | Parancsfájlhiba tesztelés közben: Modul:JSON:76: attempt to call upvalue 'gsub' (a nil value)
stack traceback:
	[C]: in function 'gsub'
	Modul:JSON:76: in function <Modul:JSON:68>
	(tail call): ?
	Modul:JSON:119: in function <Modul:JSON:112>
	(tail call): ?
	Modul:JSON:119: in function <Modul:JSON:112>
	(tail call): ?
	(tail call): ?
	(tail call): ?
	Modul:languages/testcases:163: in function <Modul:languages/testcases:162>
	(tail call): ?
	[C]: in function 'xpcall'
	Modul:UnitTests:286: in function <Modul:UnitTests:251>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

local tests = require("Module:UnitTests")

local m_languages = require("Module:languages")
local tag = require("Module:script utilities").tag_text

-- Auto-create language objects: langs.en -> language object for English.
local langs = require ("Module:languages/cache")

function tests:check(funcName)
	-- Use English language object to test for existence of function.
	local func = langs.en[funcName] or error("No function named " .. funcName .. " in language object.")
	local options = {}
	return function(self, lang, example, expected, ...)
		function options.display(text)
			return tag(text, lang)
		end
		self:equals(tag(example, lang) .. " (" .. lang:getCanonicalName() .. ", <code>" .. lang:getCode() .. "</code>)",
			func(lang, example, ...),
			expected,
			options)
	end
end

function tests:test_makeEntryName()
	local examples = {
		{ langs.la, "hūmānitās", "humanitas" },
		{ langs.la, "coëō", "coeo" },
		{ langs.ha, "àzàhàr̃iyyā̀", "azahariyya" },
		{ langs.en, "alas!", "alas" },
		{ langs.es, "¿cómo te llamas?", "cómo te llamas" },
		{ langs.ru, "ӓ ё", "а ё" },
		{ langs.es, "¿ ?", "¿ ?" },
		{ langs.es, "¡ !", "¡ !" },
		{ langs.fr, "mais bien sûr !", "mais bien sûr" },
		{ langs.mul, "¡", "¡" },
		{ langs.grc, "Πηληῐ̈ᾰ́δης", "Πηληϊάδης" },
		{ langs.ar, "العَرَبِيَّة", "العربية" },
		{ langs.ar, "ٱ", "ٱ" }, -- special case: alif waṣla
		{ langs.ar, "ـُ", "ـُ" }, -- special case: taṭwīl with vowel diacritic
		{ langs.okm, "치〯", "치" },
	}
	
	self:iterate(examples, self:check("makeEntryName"))
end

function tests:test_makeDisplayText()
	local examples = {
		{ langs.ta, "ஸ்ரீகாகுளம்", "ஶ்ரீகாகுளம்" },
	}
	
	self:iterate(examples, self:check("makeDisplayText"))
end

function tests:test_makeSortKey()
	local examples = {
		"diacritic removal",
		{ langs.grc, "Πηληϊάδης Αἶνος", "ΠΗΛΗΙΑΔΗΣ ΑΙΝΟΣ" },
		{ langs.nv, "shį́į́dą́ą́ʼ", "SHIIDAA" },
		"dedicated sortkey modules",
		{ langs.vi, "Tuyên ngôn toàn thế giới về nhân quyền của Liên Hợp Quốc", "TUYE₂N NGO₂N TOAN1 THE₂4 GIO₃I4 VE₂1 NHA₂N QUYE₂N1 CUA2 LIE₂N HO₃P5 QUO₂C4" },
		{ langs.zh, "命裡有時終須有,命裡無時莫強求", "口05衣07月02日06糸05頁03月02,口05衣07火08日06艸07弓08水02" },
		{ langs.zh, "⿺辶⿳穴⿲月⿱⿲幺言幺⿲長馬長刂心⿺辶⿳穴⿲月⿱⿲幺言幺⿲長馬長刂心麵", "辵54辵54麥09" },
		"dotted and dotless i",
		{ langs.tr, "İzmir", "İZMİR" },
		{ langs.tr, "ışık", "IŞIK" }
	}
	self:iterate(examples, self:check("makeSortKey"))
end

function tests:test_getWikipediaArticle()
	local examples = {
		{"en", "English language"},
		{"af", "Afrikaans"},
		{"ae", "Avestan"},
		{"ht", "Haitian Creole"},
		{"ase", "American Sign Language"},
		{"dv", "Maldivian language"},
		{"eo", "Esperanto"},
		{"goh", "Old High German"},
	}

	self:iterate(examples, function(self, lang, expected)
		self:equals(lang, langs[lang]:getWikipediaArticle(), expected)
	end)
end

function tests:test_makeWikipediaLink()
	local examples = {
		{"en", "[[w:English language|English]]"},
		{"af", "[[w:Afrikaans|Afrikaans]]"},
		{"ae", "[[w:Avestan|Avestan]]"},
	}
	
	self:iterate(examples, function(self, lang, expected)
		self:equals(lang, langs[lang]:makeWikipediaLink(), expected, {nowiki=1})
	end)
end

function tests:test_getFamily()
	local examples = {
		{"en", "gmw"},
		{"ht", "crp"},
		{"ase", "sgn"}
	}

	self:iterate(examples, function(self, lang, expected)
		self:equals(lang, langs[lang]:getFamily():getCode(), expected)
	end)
end

function tests:test_getScriptCodes()
	local examples = {
		{"en", {"Latn", "Brai", "Shaw", "Dsrt"}},
		{"ht", {"Latn"}},
		{"ase", {"Sgnw"}}
	}

	self:iterate(examples, function(self, lang, expected)
		self:equals_deep(lang, langs[lang]:getScriptCodes(), expected, {})
	end)
end

function tests:test_getOtherNames()
	local examples = {
		{"ht", {"Creole", "Haitian", "Kreyòl"}},
		{"ase", {"Ameslan", "ASL"}}
	}

	self:iterate(examples, function(self, lang, expected)
		self:equals_deep(lang, langs[lang]:getOtherNames(), expected, {})
	end)
end

function tests:test_getCategoryName()
	local examples = {
		{"en", "English language"},
		{"af", "Afrikaans language"},
		{"av", "Avar language"},
		{"ht", "Haitian Creole language"},
		{"ase", "American Sign Language"}
	}

	self:iterate(examples, function(self, lang, expected)
		self:equals(lang, langs[lang]:getCategoryName(), expected)
	end)
end

function tests:test_getWikidataItem()
	local examples = {
		{"en", "Q1860"},
		{"eo", "Q143"},
		{"aql-pro", "Q18389588"},
		{"mkh-ban-pro", nil},
		
	}

	self:iterate(examples, function(self, lang, expected)
		self:equals(lang, langs[lang]:getWikidataItem(), expected)
	end)
end

function tests:test_toJSON() 
	self:equals('en-toJSON', langs.en:toJSON(), [[{"ancestors" : ["enm"], "code" : "en", "canonicalName" : "English", "wikimediaLanguages" : ["en", "simple"], "wikidataItem" : "Q1860", "scripts" : ["Latn", "Brai", "Shaw", "Dsrt"], "family" : "gmw", "otherNames" : ["Modern English", "New English", "Hawaiian Creole English", "Hawai'ian Creole English", "Hawaiian Creole", "Hawai'ian Creole", "Polari", "Yinglish"], "categoryName" : "English language", "type" : "regular"}]])
end

function tests:test_getNonEtymological()
	local examples = {
		{ "de", "de" },
		{ "de-AT", "de" },
		{ "de-AT-vie", "de" },
		{ "gem", "gem" },
	}

	self:iterate(examples, function(self, lang, expected)
		self:equals(lang, langs[lang]:getNonEtymological():getCode(), expected)
	end)
end

for k, v in require "Module:table".sortedPairs(tests) do
	if type(k) == "string" and k:sub(1, 5) == "test_" then
		local new_key = k:gsub('^test_(.+)$', 'testcases for <code>%1</code>')
		tests[new_key], tests[k] = v, nil
	end
end

return tests