Modul:el-subst/test
All tests passed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
mut.test("form", "el-subst-m|form1|form2|form3|form4|form5|form6|form7|form8"), "export") | {plur_vok="form8", sing_gen="form2", plur_nom="form5", sing_nom="form1", sing_vok="form4", plur_gen="form6", sing_ack="form3", plur_ack="form7"} | {plur_vok="form8", sing_gen="form2", plur_nom="form5", sing_nom="form1", sing_vok="form4", plur_gen="form6", sing_ack="form3", plur_ack="form7"} | |
mut.test("form", "el-subst-f|form1|form2|form3|form4|form5|form6|form7|form8"), "export") | {plur_vok="form8", sing_gen="form2", plur_nom="form5", sing_nom="form1", sing_vok="form4", plur_gen="form6", sing_ack="form3", plur_ack="form7"} | {plur_vok="form8", sing_gen="form2", plur_nom="form5", sing_nom="form1", sing_vok="form4", plur_gen="form6", sing_ack="form3", plur_ack="form7"} | |
mut.test("form", "el-subst-n|form1|form2|form3|form4|form5|form6|form7|form8"), "export") | {plur_vok="form8", sing_gen="form2", plur_nom="form5", sing_nom="form1", sing_vok="form4", plur_gen="form6", sing_ack="form3", plur_ack="form7"} | {plur_vok="form8", sing_gen="form2", plur_nom="form5", sing_nom="form1", sing_vok="form4", plur_gen="form6", sing_ack="form3", plur_ack="form7"} |
Text | Expected | Actual | |
---|---|---|---|
mut.test("form", "el-subst-m-oräkn|form1|form2|form3|form4"), "export") | {vok="form4", nom="form1", ack="form3", gen="form2"} | {vok="form4", nom="form1", ack="form3", gen="form2"} |
Text | Expected | Actual | |
---|---|---|---|
mut.test("form", "el-subst-m", "export") | {plur_vok="?", sing_gen="?", plur_nom="?", sing_nom="form", sing_vok="?", plur_gen="?", sing_ack="?", plur_ack="?"} | {plur_vok="?", sing_gen="?", plur_nom="?", sing_nom="form", sing_vok="?", plur_gen="?", sing_ack="?", plur_ack="?"} |
local t = require("Modul:UnitTests")
local mut = require("Modul:el-subst")
local function nowikiPipe(str)
return mw.ustring.gsub(str, "|", "<nowiki>|</nowiki>")
end
function t:test01_basic()
self:equals_deep(nowikiPipe('mut.test("form", "el-subst-m|form1|form2|form3|form4|form5|form6|form7|form8"), "export")'), mut.test("form", "el-subst-m|form1|form2|form3|form4|form5|form6|form7|form8", "export"),
{
sing_nom="form1",
sing_gen="form2",
sing_ack="form3",
sing_vok="form4",
plur_nom="form5",
plur_gen="form6",
plur_ack="form7",
plur_vok="form8"
}
)
self:equals_deep(nowikiPipe('mut.test("form", "el-subst-f|form1|form2|form3|form4|form5|form6|form7|form8"), "export")'), mut.test("form", "el-subst-f|form1|form2|form3|form4|form5|form6|form7|form8", "export"),
{
sing_nom="form1",
sing_gen="form2",
sing_ack="form3",
sing_vok="form4",
plur_nom="form5",
plur_gen="form6",
plur_ack="form7",
plur_vok="form8"
}
)
self:equals_deep(nowikiPipe('mut.test("form", "el-subst-n|form1|form2|form3|form4|form5|form6|form7|form8"), "export")'), mut.test("form", "el-subst-n|form1|form2|form3|form4|form5|form6|form7|form8", "export"),
{
sing_nom="form1",
sing_gen="form2",
sing_ack="form3",
sing_vok="form4",
plur_nom="form5",
plur_gen="form6",
plur_ack="form7",
plur_vok="form8"
}
)
end
function t:test02_basic_uncountable()
self:equals_deep(nowikiPipe('mut.test("form", "el-subst-m-oräkn|form1|form2|form3|form4"), "export")'), mut.test("form", "el-subst-m-oräkn|form1|form2|form3|form4", "export"),
{
nom="form1",
gen="form2",
ack="form3",
vok="form4"
}
)
end
function t:test03_no_arguments()
self:equals_deep('mut.test("form", "el-subst-m", "export")', mut.test("form", "el-subst-m", "export"),
{
sing_nom="form",
sing_gen="?",
sing_ack="?",
sing_vok="?",
plur_nom="?",
plur_gen="?",
plur_ack="?",
plur_vok="?"
}
)
end
return t