Jump to content

Module:etymology languages/testcases

Wiktionary වෙතින්

6 of 0 tests failed. (refresh)

TextExpectedActual
test_getCanonicalName:
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:etymology_languages/testcases:9: in function <Module:etymology_languages/testcases:8>
	Module:etymology_languages/testcases:56: in function 'func'
	Module:UnitTests:295: in function 'iterate'
	Module:etymology_languages/testcases:55: in function <Module:etymology_languages/testcases:50>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:895: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActual
test_getOtherNames:
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:etymology_languages/testcases:9: in function <Module:etymology_languages/testcases:8>
	Module:etymology_languages/testcases:66: in function 'func'
	Module:UnitTests:295: in function 'iterate'
	Module:etymology_languages/testcases:65: in function <Module:etymology_languages/testcases:60>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:895: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActual
test_getParentCode:
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:etymology_languages/testcases:9: in function <Module:etymology_languages/testcases:8>
	Module:etymology_languages/testcases:76: in function 'func'
	Module:UnitTests:295: in function 'iterate'
	Module:etymology_languages/testcases:75: in function <Module:etymology_languages/testcases:70>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:895: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActual
test_getWikidataItem:
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:etymology_languages/testcases:9: in function <Module:etymology_languages/testcases:8>
	Module:etymology_languages/testcases:33: in function 'func'
	Module:UnitTests:295: in function 'iterate'
	Module:etymology_languages/testcases:32: in function <Module:etymology_languages/testcases:26>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:895: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActual
test_getWikipediaArticle:
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:etymology_languages/testcases:9: in function <Module:etymology_languages/testcases:8>
	Module:etymology_languages/testcases:22: in function 'func'
	Module:UnitTests:295: in function 'iterate'
	Module:etymology_languages/testcases:21: in function <Module:etymology_languages/testcases:15>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:895: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
TextExpectedActual
test_makeWikipediaLink:
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.
stack traceback:
	[C]: ?
	[C]: in function 'error'
	Module:etymology_languages/testcases:9: in function <Module:etymology_languages/testcases:8>
	Module:etymology_languages/testcases:46: in function 'func'
	Module:UnitTests:295: in function 'iterate'
	Module:etymology_languages/testcases:45: in function <Module:etymology_languages/testcases:37>
	(tail call): ?
	[C]: in function 'xpcall'
	Module:UnitTests:369: in function <Module:UnitTests:328>
	(tail call): ?
	mw.lua:527: in function <mw.lua:507>
	[C]: ?
	[C]: in function 'expandTemplate'
	mw.lua:333: in function 'expandTemplate'
	Module:documentation:895: in function 'chunk'
	mw.lua:527: in function <mw.lua:507>
	[C]: ?

local tests = require("Module:UnitTests")

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

local langs = {}
setmetatable(langs, { -- Auto-create language objects: langs.en -> language object for English.
	__index = function(self, key)
		local lang = getByCode(key) or error("No language with code " .. key .. ".")
		self[key] = lang
		return lang
	end
})

function tests:test_getWikipediaArticle()
	local examples = {
		{"sem-jar", "Judeo-Aramaic languages"},
		{"sbr-prk", "Sabari"},
	}

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

function tests:test_getWikidataItem()
	local examples = {
		{"sem-jar", "Q2633045"},
		{"sbr-prk", nil},
	}

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

function tests:test_makeWikipediaLink()
	local examples = {
		{"sem-jar", "[[w:Judeo-Aramaic languages|Jewish Aramaic]]"},
		{"sbr-prk", "[[w:Sabari|Sabari]]"},
		{"okz-A", "[[w:Khmer language#Historical periods|Angkorian Old Khmer]]"},
		{"urj-fpr-pro", "[[w:Proto-Finno-Permic|Proto-Finno-Permic]]"},
	}
	
	self:iterate(examples, function(self, lang, expected)
		self:equals(lang, langs[lang]:makeWikipediaLink(), expected, {nowiki=1})
	end)
end

function tests:test_getCanonicalName()
	local examples = {
		{"sem-jar", "Jewish Aramaic"},
	}

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

function tests:test_getOtherNames()
	local examples = {
		{"sem-jar", {"Judeo-Aramaic"}},
	}

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

function tests:test_getParentCode()
	local examples = {
		{"sem-jar", "arc"},
	}

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

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