Modul:utilities/testcases
Penampilan
- Berikut merupakan pendokumenan yang terletak di Modul:utilities/testcases/doc. [sunting]
- Pautan berguna: laman akar • sublaman • pautan • transklusi • modul ujian • kotak pasir
5 of 5 tests failed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
English lemmas (en, cliché) | [[Category:English lemmas|CLICHE]] | [[Kategori:English lemmas|TESTCASES]] | |
English lemmas (en, Reconstruction:Proto-Indo-European/dn̥ǵʰwéh₂s) | [[Category:English lemmas|DN̥ǴʰWEH₂S]] | [[Kategori:English lemmas|TESTCASES]] | |
English lemmas (en, Appendix:English doublets) | [[Category:English lemmas|ENGLISH DOUBLETS]] | [[Kategori:English lemmas|TESTCASES]] | |
English lemmas (en, Citations:word) | [[Category:English lemmas|WORD]] | [[Kategori:English lemmas|TESTCASES]] | |
English lemmas (en, Wiktionary:Grease pit) | [[Kategori: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