All tests passed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
{{g-länk|sv|verb|vare, ]}} | {h3="verb", lang="sv", forms={infl="vare, vore"}} | {h3="verb", lang="sv", forms={infl="vare, vore"}} | |
{{g-länk|eo|adj|form|typ=adv}} | {h3="adj", lang="eo", forms={x_adv="form"}} | {h3="adj", lang="eo", forms={x_adv="form"}} |
Text | Expected | Actual | |
---|---|---|---|
{{sv-adj|pers=}} | {h3="adj", lang="sv", forms={attr_komp_mask="roligare", attr_obest_sing_neutrum_pos="roligt", attr_best_sing_alla_pos="roliga", pred_plur_pos="roliga", attr_plur_pos="roliga", attr_best_sing_mask_sup="roligaste", pred_sing_utrum_pos="rolig", attr_best_sing_mask_pos="rolige", pred_sing_neutrum_pos="roligt", x_adv="roligt?", attr_obest_sing_utrum_pos="rolig", pred_komp="roligare", attr_sup="roligaste", attr_komp="roligare", pred_sup="roligast"}} | {h3="adj", lang="sv", forms={attr_komp_mask="roligare", attr_obest_sing_neutrum_pos="roligt", attr_komp="roligare", attr_best_sing_alla_pos="roliga", attr_plur_pos="roliga", attr_best_sing_mask_pos="rolige", attr_sup="roligaste", attr_best_sing_mask_sup="roligaste", pred_sing_utrum_pos="rolig", x_adv="roligt?", pred_komp="roligare", attr_obest_sing_utrum_pos="rolig", pred_sing_neutrum_pos="roligt", pred_plur_pos="roliga", pred_sup="roligast"}} |
local t = require("Modul:UnitTests")
function getJsonDecoded(text)
local preprocessed = t.frame:preprocess(text)
return mw.text.jsonDecode(preprocessed)
end
function t:testGrammarLink()
self:equals_deep("<nowiki>{{g-länk|sv|verb|vare, ]}}</nowiki>",
getJsonDecoded("{{#invoke:grammar-export|getJson|pagename=vara|template=g-länk|sv|verb|vare, ]}}"),
{ lang = "sv", h3 = "verb", forms = { infl = "vare, vore" } },
{ nowiki = 1 })
self:equals_deep("<nowiki>{{g-länk|eo|adj|form|typ=adv}}</nowiki>",
getJsonDecoded("{{#invoke:grammar-export|getJson|pagename=vara|template=g-länk|eo|adj|form|typ=adv}}"),
{ lang = "eo", h3 = "adj", forms = { x_adv = "form" } })
end
function t:testGrammarModule()
self:equals_deep("<nowiki>{{sv-adj|pers=}}</nowiki>",
getJsonDecoded("{{#invoke:grammar-export|getJson|pagename=rolig|template=sv-adj|pers=}}"),
{
lang = "sv",
h3 = "adj",
forms = {
attr_best_sing_alla_pos="roliga",
attr_best_sing_mask_pos="rolige",
attr_best_sing_mask_sup="roligaste",
attr_komp="roligare",
attr_komp_mask="roligare",
attr_obest_sing_neutrum_pos="roligt",
attr_obest_sing_utrum_pos="rolig",
attr_plur_pos="roliga",
attr_sup="roligaste",
pred_komp="roligare",
pred_plur_pos="roliga",
pred_sing_neutrum_pos="roligt",
pred_sing_utrum_pos="rolig",
pred_sup="roligast",
x_adv="roligt?",
}
})
end
return t