Module:utilities/testcases
- පහත දැක්වෙන උපදෙස්, Module:utilities/testcases/documentation හි පිහිටා ඇත. Module:utilities/testcases/documentation]]. [සංස්කරණය]
- ප්රයෝජනවත් සබැඳි: root page • root page’s subpages • සබැඳි • transclusions • tested module • sandbox
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é", "[[Category:English lemmas|CLICHE]]" },
{ "English lemmas", "en", "Reconstruction:Proto-Indo-European/dn̥ǵʰwéh₂s", "[[Category:English lemmas|DN̥ǴʰWEH₂S]]" },
{ "English lemmas", "en", "Appendix:English doublets", "[[Category:English lemmas|ENGLISH DOUBLETS]]" },
{ "English lemmas", "en", "Citations:word", "[[Category:English lemmas|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 .. ", [[" .. title .. "]])",
format_categories({ category }, languages[lang]),
expected,
options)
end)
mw.title.getCurrentTitle = actualGetCurrentTitle
end
return tests