local tests = require("Module:UnitTests")
local m_root = require("Module:root")
local function display(categories)
return categories
end
function tests:test_categorize()
local examples = {
{ "lang", "source", { "root1" }, { "id1" }, "result" },
}
local get_by_code = require("Module:languages").getByCode
self:iterate(examples, function (self, lang, source, roots, ids, result)
self:equals(
("%s %s %s %s %s"):format(
lang,
source,
table.concat(roots, ", "),
table.concat(ids, ", ")),
display(
m_root.categorize(
get_by_code(lang),
get_by_code(source),
roots,
ids)),
display(result))
end)
end
return tests