6 of 0 tests failed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.stack traceback: : ? : 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:296: in function 'iterate' Module:etymology_languages/testcases:55: in function <Module:etymology_languages/testcases:50> (tail call): ? : in function 'xpcall' Module:UnitTests:370: in function <Module:UnitTests:329> (tail call): ? mw.lua:527: in function <mw.lua:507> : ? : in function 'expandTemplate' mw.lua:333: in function 'expandTemplate' Module:documentation:891: in function 'chunk' mw.lua:527: in function <mw.lua:507> : ? |
Text | Expected | Actual | |
---|---|---|---|
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.stack traceback: : ? : 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:296: in function 'iterate' Module:etymology_languages/testcases:65: in function <Module:etymology_languages/testcases:60> (tail call): ? : in function 'xpcall' Module:UnitTests:370: in function <Module:UnitTests:329> (tail call): ? mw.lua:527: in function <mw.lua:507> : ? : in function 'expandTemplate' mw.lua:333: in function 'expandTemplate' Module:documentation:891: in function 'chunk' mw.lua:527: in function <mw.lua:507> : ? |
Text | Expected | Actual | |
---|---|---|---|
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.stack traceback: : ? : 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:296: in function 'iterate' Module:etymology_languages/testcases:75: in function <Module:etymology_languages/testcases:70> (tail call): ? : in function 'xpcall' Module:UnitTests:370: in function <Module:UnitTests:329> (tail call): ? mw.lua:527: in function <mw.lua:507> : ? : in function 'expandTemplate' mw.lua:333: in function 'expandTemplate' Module:documentation:891: in function 'chunk' mw.lua:527: in function <mw.lua:507> : ? |
Text | Expected | Actual | |
---|---|---|---|
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.stack traceback: : ? : 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:296: in function 'iterate' Module:etymology_languages/testcases:32: in function <Module:etymology_languages/testcases:26> (tail call): ? : in function 'xpcall' Module:UnitTests:370: in function <Module:UnitTests:329> (tail call): ? mw.lua:527: in function <mw.lua:507> : ? : in function 'expandTemplate' mw.lua:333: in function 'expandTemplate' Module:documentation:891: in function 'chunk' mw.lua:527: in function <mw.lua:507> : ? |
Text | Expected | Actual | |
---|---|---|---|
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.stack traceback: : ? : 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:296: in function 'iterate' Module:etymology_languages/testcases:21: in function <Module:etymology_languages/testcases:15> (tail call): ? : in function 'xpcall' Module:UnitTests:370: in function <Module:UnitTests:329> (tail call): ? mw.lua:527: in function <mw.lua:507> : ? : in function 'expandTemplate' mw.lua:333: in function 'expandTemplate' Module:documentation:891: in function 'chunk' mw.lua:527: in function <mw.lua:507> : ? |
Text | Expected | Actual | |
---|---|---|---|
Script error during testing: Module:etymology_languages/testcases:9: No language with code sem-jar.stack traceback: : ? : 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:296: in function 'iterate' Module:etymology_languages/testcases:45: in function <Module:etymology_languages/testcases:37> (tail call): ? : in function 'xpcall' Module:UnitTests:370: in function <Module:UnitTests:329> (tail call): ? mw.lua:527: in function <mw.lua:507> : ? : in function 'expandTemplate' mw.lua:333: in function 'expandTemplate' Module:documentation:891: in function 'chunk' mw.lua:527: in function <mw.lua:507> : ? |
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 = 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: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:getWikidataItem(), expected)
end)
end
function tests:test_makeWikipediaLink()
local examples = {
{"sem-jar", "]"},
{"sbr-prk", "]"},
{"okz-A", "]"},
{"urj-fpr-pro", "]"},
}
self:iterate(examples, function(self, lang, expected)
self:equals(lang, langs: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: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:getOtherNames(), expected)
end)
end
function tests:test_getParentCode()
local examples = {
{"sem-jar", "arc"},
}
self:iterate(examples, function(self, lang, expected)
self:equals(lang, langs:getParentCode(), expected)
end)
end
return tests