20 tests failed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
mut.getRow({"!", "rubrik", '|rowspan="2"'}, "form1", "form2", "form3") | |-
!|rubrik |rowspan="2"|<span class="infl">[]</span> ||<span class="infl">[]</span> ||<span class="infl">[]</span> || |- !|rubrik |rowspan="2"|<span data-grammar-link="infl">[]</span> ||<span data-grammar-link="infl">[]</span> ||<span data-grammar-link="infl">[]</span> | ||
mut.getRow({"|", "], ]", type="adv"}, "], ]") | |-
||<span class="adv">[]</span>, <span class="adv">[]</span> ||<span class="infl">[]</span>, <span class="infl">[]</span> || |- ||<span data-grammar-link="adv">[]</span>, <span data-grammar-link="adv">[]</span> ||<span data-grammar-link="infl">[]</span>, <span data-grammar-link="infl">[]</span> | ||
mut.getRow("form1, form2") | |-
||<span class="infl">[]</span>, <span class="infl">[]</span> || |- ||<span data-grammar-link="infl">[]</span>, <span data-grammar-link="infl">[]</span> |
Text | Expected | Actual | |
---|---|---|---|
mut.getRow("form1", "form2", "form3") | |-
||<span class="infl">[]</span> ||<span class="infl">[]</span> ||<span class="infl">[]</span> || |- ||<span data-grammar-link="infl">[]</span> ||<span data-grammar-link="infl">[]</span> ||<span data-grammar-link="infl">[]</span> |
Text | Expected | Actual | |
---|---|---|---|
mut.getRow({"!"}, {"|rowspan=2"}, {'|class="min"'}) | |-
!| |rowspan="2"| [[Kategori:Wiktionary:Sidor med tomma celler]] |class="min"| [[Kategori:Wiktionary:Sidor med tomma celler]] || |- !| |rowspan="2"| [[Kategori:Wiktionary:Sidor med tomma celler]] |class="min"| [[Kategori:Wiktionary:Sidor med tomma celler]] |
Text | Expected | Actual | |
---|---|---|---|
mut.getRow({"!", type="no-link"}, {'|rowspan="2"', type="no-link"}) | |-
!| |rowspan="2"| [[Kategori:Wiktionary:Sidor med tomma celler]] || |- !| |rowspan="2"| [[Kategori:Wiktionary:Sidor med tomma celler]] |
Text | Expected | Actual | |
---|---|---|---|
mut.getRow("], form2") | |-
||<span class="infl">[]</span>, <span class="infl">[]</span> || |- ||<span data-grammar-link="infl">[]</span>, <span data-grammar-link="infl">[]</span> | ||
mut.getRow("]<sup>1</sup>") | |-
||<span class="infl">[]</span><sup>1</sup> || |- ||<span data-grammar-link="infl">[]</span><sup>1</sup> | ||
mut.getRow("], vard. ]") | |-
||<span class="infl">[]</span>, vard. <span class="infl">[]</span> || |- ||<span data-grammar-link="infl">[]</span>, vard. <span data-grammar-link="infl">[]</span> | ||
mut.getRow("(])") | |-
||'''('''<span class="infl">[]</span>''')''' || |- ||'''('''<span data-grammar-link="infl">[]</span>''')''' | ||
mut.getRow("]") | |-
||<span class="infl">[[form1|fōrm1]]</span> || |- ||<span data-grammar-link="infl">[[form1|fōrm1]]</span> | ||
mut.getRow("<nowiki/>form1, form2") Med nowiki i modul |
|-
||<nowiki/>form1, <span class="infl">[]</span> || |- ||<nowiki/>form1, <span data-grammar-link="infl">[]</span> | ||
mut.getRow("<nowiki/>form1, form2") Med nowiki i mall |
|-
||"`UNIQ--nowiki-00000001-QINU`"'form1, <span class="infl">[]</span> || |- ||"`UNIQ--nowiki-00000001-QINU`"'form1, <span data-grammar-link="infl">[]</span> |
Text | Expected | Actual | |
---|---|---|---|
mut.getRow("ord1 ord2") | |-
||ord1 ord2 || |- ||ord1 ord2 |
Text | Expected | Actual | |
---|---|---|---|
mut.getRow(nil) | |- | |- | |
mut.getRow("") | |-
|| [[Kategori:Wiktionary:Sidor med tomma celler]] || |- || [[Kategori:Wiktionary:Sidor med tomma celler]] | ||
mut.getRow("-") | |-
||– || |- ||– | ||
mut.getRow("?") | |-
||? || |- ||? | ||
", type="no-link"})) | |-
|| [[Kategori:Wiktionary:Sidor med tomma celler]] || |- || [[Kategori:Wiktionary:Sidor med tomma celler]] | ||
", "", type="no-link"})) | |-
|| [[Kategori:Wiktionary:Sidor med tomma celler]] || |- || [[Kategori:Wiktionary:Sidor med tomma celler]] | ||
", "-", type="no-link"})) | |-
||– || |- ||– | ||
", "?", type="no-link"})) | |-
||? || |- ||? |
Text | Expected | Actual | |
---|---|---|---|
mut.getRow("e-post") | |-
||<span class="infl">[[e-post]]</span> || |- ||<span data-grammar-link="infl">[[e-post]]</span> | ||
mut.getRow("word's") | |-
||<span class="infl">[[word's]]</span> || |- ||<span data-grammar-link="infl">[[word's]]</span> | ||
mut.getRow("words'") | |-
||<span class="infl">[[words']]</span> || |- ||<span data-grammar-link="infl">[[words']]</span> | ||
mut.getRow("tv:n") | |-
||<span class="infl">[[tv:n]]</span> || |- ||<span data-grammar-link="infl">[[tv:n]]</span> | ||
mut.getRow("]") | |-
||<span class="infl">[[Övriga_uppslagsord#EU:s|EU:s]]</span> || |- ||<span data-grammar-link="infl">[[Övriga_uppslagsord#EU:s|EU:s]]</span> | ||
mut.getRow("'']''") | |-
||''<span class="infl">[]</span>'' || |- ||''<span data-grammar-link="infl">[]</span>'' |
Text | Expected | Actual | |
---|---|---|---|
mut.setLanguage("de") | (nil) | (nil) | |
mut.getRow({"!", "rubrik", '|rowspan="2"'}, "form1", "form2", "form3") | |-
!|rubrik |rowspan="2"|<span class="infl">[[form1#Tyska|form1]]</span> ||<span class="infl">[[form2#Tyska|form2]]</span> ||<span class="infl">[[form3#Tyska|form3]]</span> || |- !|rubrik |rowspan="2"|<span data-grammar-link="infl">[[form1#Tyska|form1]]</span> ||<span data-grammar-link="infl">[[form2#Tyska|form2]]</span> ||<span data-grammar-link="infl">[[form3#Tyska|form3]]</span> | ||
mut.getRow({"|", "], ]", type="adv"}, "], ]") | |-
||<span class="adv">[[form1#Tyska|form1]]</span>, <span class="adv">[[form2#Tyska|form2]]</span> ||<span class="infl">[[form3#Tyska|form3]]</span>, <span class="infl">[[form4#Tyska|form4]]</span> || |- ||<span data-grammar-link="adv">[[form1#Tyska|form1]]</span>, <span data-grammar-link="adv">[[form2#Tyska|form2]]</span> ||<span data-grammar-link="infl">[[form3#Tyska|form3]]</span>, <span data-grammar-link="infl">[[form4#Tyska|form4]]</span> | ||
mut.getRow("form1, form2") | |-
||<span class="infl">[[form1#Tyska|form1]]</span>, <span class="infl">[[form2#Tyska|form2]]</span> || |- ||<span data-grammar-link="infl">[[form1#Tyska|form1]]</span>, <span data-grammar-link="infl">[[form2#Tyska|form2]]</span> |
local t = require("Modul:UnitTests")
local mut = require("Modul:grammar-table")
local nowiki = function(s)
return s:gsub('', { = "\n !", = "\r !"})
end
function t:test01_basic()
self:equals('<nowiki>mut.getRow({"!", "rubrik", \'|rowspan="2"\'}, "form1", "form2", "form3")</nowiki>', nowiki(mut.getRow({"!", "rubrik"}, {'|rowspan="2"', "form1"}, "form2", "form3")), nowiki('|-\n!|rubrik\n|rowspan="2"|<span class="infl">]</span>\n||<span class="infl">]</span>\n||<span class="infl">]</span>\n'), {nowiki=1})
self:equals('<nowiki>mut.getRow({"|", "], ]", type="adv"}, "], ]")</nowiki>', mut.getRow({"|", "], ]", type="adv"}, "], ]"), '|-\n||<span class="adv">]</span>, <span class="adv">]</span>\n||<span class="infl">]</span>, <span class="infl">]</span>\n', {nowiki=1})
self:equals('<nowiki>mut.getRow("form1, form2")</nowiki>', nowiki(mut.getRow("form1, form2")), nowiki('|-\n||<span class="infl">]</span>, <span class="infl">]</span>\n'), {nowiki=1})
end
function t:test02_only_content()
self:equals('mut.getRow("form1", "form2", "form3")', nowiki(mut.getRow("form1", "form2", "form3")), nowiki('|-\n||<span class="infl">]</span>\n||<span class="infl">]</span>\n||<span class="infl">]</span>\n'), {nowiki=1})
end
function t:test03_only_meta()
self:equals('<nowiki>mut.getRow({"!"}, {"|rowspan=2"}, {\'|class="min"\'})</nowiki>', nowiki(mut.getRow({"!"}, {'|rowspan="2"'}, {'|class="min"'})), nowiki('|-\n!| \n|rowspan="2"| ]\n|class="min"| ]\n'), {nowiki=1})
end
function t:test04_only_meta_and_type()
self:equals('<nowiki>mut.getRow({"!", type="no-link"}, {\'|rowspan="2"\', type="no-link"})</nowiki>', nowiki(mut.getRow({"!", type="no-link"}, {'|rowspan="2"', type="no-link"})), nowiki('|-\n!| \n|rowspan="2"| ]\n'), {nowiki=1})
end
function t:test05_no_extra_links()
self:equals('<nowiki>mut.getRow("], form2")</nowiki>', nowiki(mut.getRow("], form2")), nowiki('|-\n||<span class="infl">]</span>, <span class="infl">]</span>\n'), {nowiki=1})
self:equals('<nowiki>mut.getRow("]<sup>1</sup>")</nowiki>', nowiki(mut.getRow("]<sup>1</sup>")), nowiki('|-\n||<span class="infl">]</span><sup>1</sup>\n'), {nowiki=1})
self:equals('<nowiki>mut.getRow("], vard. ]")</nowiki>', nowiki(mut.getRow("], vard. ]")), nowiki('|-\n||<span class="infl">]</span>, vard. <span class="infl">]</span>\n'), {nowiki=1})
self:equals('<nowiki>mut.getRow("(])")</nowiki>', nowiki(mut.getRow("(])")), nowiki("|-\n||'''('''<span class=\"infl\">]</span>''')'''\n"), {nowiki=1})
self:equals('<nowiki>mut.getRow("]")</nowiki>', nowiki(mut.getRow("]")), nowiki('|-\n||<span class="infl">]</span>\n'), {nowiki=1})
-- self:equals('<nowiki>mut.getRow("]<ref>]</ref>")</nowiki>', nowiki(mut.getRow("]<ref>]</ref>")), nowiki('|-\n||<span class="infl">]</span><ref>]</ref>\n'), {nowiki=1}) -- inaktiverad tills vi vet hur vi vill ha det
self:equals(], nowiki(mut.getRow("<nowiki/>form1, form2")), nowiki('|-\n||<nowiki/>form1, <span class="infl">]</span>\n'), {nowiki=1})
local uniq_nowiki = "\127\"`UNIQ--nowiki-00000001-QINU`\"'\127"
self:equals(], nowiki(mut.getRow(uniq_nowiki .. "form1, form2")), nowiki('|-\n||' .. uniq_nowiki .. 'form1, <span class="infl">]</span>\n'), {nowiki=1})
end
function t:test06_multiple_words()
-- TODO eller ska dom länkas?
self:equals('<nowiki>mut.getRow("ord1 ord2")</nowiki>', nowiki(mut.getRow("ord1 ord2")), nowiki('|-\n||ord1 ord2\n'), {nowiki=1})
end
function t:test07_special_cases()
--self:equals('mut.getRow({})', nowiki(mut.getRow({})), nowiki('|-\n|| ]\n'), {nowiki=1})
self:equals('mut.getRow(nil)', nowiki(mut.getRow(nil)), nowiki('|-\n'), {nowiki=1})
self:equals('mut.getRow("")', nowiki(mut.getRow("")), nowiki('|-\n|| ]\n'), {nowiki=1})
self:equals('mut.getRow("-")', nowiki(mut.getRow("-")), nowiki('|-\n||–\n'), {nowiki=1})
self:equals('mut.getRow("?")', nowiki(mut.getRow("?")), nowiki('|-\n||?\n'), {nowiki=1})
self:equals('mut.getRow({"|", type="no-link"}))', nowiki(mut.getRow({"|", type="no-link"})), nowiki('|-\n|| ]\n'), {nowiki=1})
self:equals('mut.getRow({"|", "", type="no-link"}))', nowiki(mut.getRow({"|", "", type="no-link"})), nowiki('|-\n|| ]\n'), {nowiki=1})
self:equals('mut.getRow({"|", "-", type="no-link"}))', nowiki(mut.getRow({"|", "-", type="no-link"})), nowiki('|-\n||–\n'), {nowiki=1})
self:equals('mut.getRow({"|", "?", type="no-link"}))', nowiki(mut.getRow({"|", "?", type="no-link"})), nowiki('|-\n||?\n'), {nowiki=1})
end
function t:test_08_words_containg_special_chars()
self:equals('mut.getRow("e-post")', nowiki(mut.getRow("e-post")), nowiki('|-\n||<span class="infl">]</span>\n'), {nowiki=1})
self:equals('mut.getRow("word\'s")', nowiki(mut.getRow("word's")), nowiki('|-\n||<span class="infl">]</span>\n'), {nowiki=1})
self:equals('mut.getRow("words\'")', nowiki(mut.getRow("words'")), nowiki('|-\n||<span class="infl">]</span>\n'), {nowiki=1})
self:equals('mut.getRow("tv:n")', nowiki(mut.getRow("tv:n")), nowiki('|-\n||<span class="infl">]</span>\n'), {nowiki=1})
self:equals('<nowiki>mut.getRow("]</nowiki>")', nowiki(mut.getRow("]")), nowiki('|-\n||<span class="infl">]</span>\n'), {nowiki=1})
self:equals('<nowiki>mut.getRow("\'\']\'\'</nowiki>")', nowiki(mut.getRow("'']''")), nowiki('|-\n||\'\'<span class="infl">]</span>\'\'\n'), {nowiki=1})
end
function t:test_09_basic_with_lang_code()
self:equals('mut.setLanguage("de")', mut.setLanguage("de"), nil, {nowiki=1})
self:equals('<nowiki>mut.getRow({"!", "rubrik", \'|rowspan="2"\'}, "form1", "form2", "form3")</nowiki>', nowiki(mut.getRow({"!", "rubrik"}, {'|rowspan="2"', "form1"}, "form2", "form3")), nowiki('|-\n!|rubrik\n|rowspan="2"|<span class="infl">]</span>\n||<span class="infl">]</span>\n||<span class="infl">]</span>\n'), {nowiki=1})
self:equals('<nowiki>mut.getRow({"|", "], ]", type="adv"}, "], ]")</nowiki>', mut.getRow({"|", "], ]", type="adv"}, "], ]"), '|-\n||<span class="adv">]</span>, <span class="adv">]</span>\n||<span class="infl">]</span>, <span class="infl">]</span>\n', {nowiki=1})
self:equals('<nowiki>mut.getRow("form1, form2")</nowiki>', nowiki(mut.getRow("form1, form2")), nowiki('|-\n||<span class="infl">]</span>, <span class="infl">]</span>\n'), {nowiki=1})
end
return t