5 of 5 tests failed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
English lemmas (en, cliché) | [[Category:English lemmas|CLICHE]] | [[Category:English lemmas|TESTCASES]] | |
English lemmas (en, Reconstruction:Proto-Indo-European/dn̥ǵʰwéh₂s) | [[Category:English lemmas|DN̥ǴʰWEH₂S]] | [[Category:English lemmas|TESTCASES]] | |
English lemmas (en, Appendix:English doublets) | [[Category:English lemmas|ENGLISH DOUBLETS]] | [[Category:English lemmas|TESTCASES]] | |
English lemmas (en, Citations:word) | [[Category:English lemmas|WORD]] | [[Category:English lemmas|TESTCASES]] | |
English lemmas (en, Wiktionary:Grease pit) | [[Category:English lemmas|TESTCASES]] |
local tests = require("Module:UnitTests")
local languages = require("Module:languages/cache")
local format_categories = require("Module:utilities").format_categories
local currentTitle
local function specialGetCurrentTitle()
return currentTitle
end
function tests:test_format_categories()
local examples = {
{ "English lemmas", "en", "cliché", "]" },
{ "English lemmas", "en", "Reconstruction:Proto-Indo-European/dn̥ǵʰwéh₂s", "]" },
{ "English lemmas", "en", "Appendix:English doublets", "]" },
{ "English lemmas", "en", "Citations:word", "]" },
{ "English lemmas", "en", "Wiktionary:Grease pit", "" },
}
local actualGetCurrentTitle = mw.title.getCurrentTitle
mw.title.getCurrentTitle = specialGetCurrentTitle
local options = { display = mw.text.nowiki }
self:iterate(examples,
function (self, category, lang, title, expected)
currentTitle = mw.title.new(title)
self:equals(
category .. " (" .. lang .. ", ])",
format_categories({ category }, languages),
expected,
options)
end)
mw.title.getCurrentTitle = actualGetCurrentTitle
end
return tests