Modul:grammar-table/test

Hej, du har kommit hit för att leta efter betydelsen av ordet Modul:grammar-table/test. I DICTIOUS hittar du inte bara alla ordboksbetydelser av ordet Modul:grammar-table/test, utan du får också veta mer om dess etymologi, dess egenskaper och hur man säger Modul:grammar-table/test i singular och plural. Allt du behöver veta om ordet Modul:grammar-table/test finns här. Definitionen av ordet Modul:grammar-table/test hjälper dig att vara mer exakt och korrekt när du talar eller skriver dina texter. Genom att känna till definitionen avModul:grammar-table/test och andra ord berikar du ditt ordförråd och får tillgång till fler och bättre språkliga resurser.

20 tests failed. (refresh)

Text Expected Actual
test01_basic:
Failed 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>

Failed 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>

Failed 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
test02_only_content:
Failed 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
test03_only_meta:
Passed mut.getRow({"!"}, {"|rowspan=2"}, {'|class="min"'}) |-

!|&nbsp; |rowspan="2"|&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]] |class="min"|&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]] || |- !|&nbsp; |rowspan="2"|&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]] |class="min"|&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]]

Text Expected Actual
test04_only_meta_and_type:
Passed mut.getRow({"!", type="no-link"}, {'|rowspan="2"', type="no-link"}) |-

!|&nbsp; |rowspan="2"|&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]] || |- !|&nbsp; |rowspan="2"|&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]]

Text Expected Actual
test05_no_extra_links:
Failed mut.getRow("], form2") |-

||<span class="infl">[]</span>, <span class="infl">[]</span> || |- ||<span data-grammar-link="infl">[]</span>, <span data-grammar-link="infl">[]</span>

Failed mut.getRow("]<sup>1</sup>") |-

||<span class="infl">[]</span><sup>1</sup> || |- ||<span data-grammar-link="infl">[]</span><sup>1</sup>

Failed 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>

Failed mut.getRow("(])") |-

||'''('''<span class="infl">[]</span>''')''' || |- ||'''('''<span data-grammar-link="infl">[]</span>''')'''

Failed mut.getRow("]") |-

||<span class="infl">[[form1|fōrm1]]</span> || |- ||<span data-grammar-link="infl">[[form1|fōrm1]]</span>

Failed mut.getRow("<nowiki/>form1, form2")
Med nowiki i modul
|-

||<nowiki/>form1, <span class="infl">[]</span> || |- ||<nowiki/>form1, <span data-grammar-link="infl">[]</span>

Failed 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
test06_multiple_words:
Passed mut.getRow("ord1 ord2") |-

||ord1 ord2 || |- ||ord1 ord2

Text Expected Actual
test07_special_cases:
Passed mut.getRow(nil) |- |-
Passed mut.getRow("") |-

||&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]] || |- ||&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]]

Passed mut.getRow("-") |-

||– || |- ||–

Passed mut.getRow("?") |-

||? || |- ||?

Passed ", type="no-link"})) |-

||&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]] || |- ||&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]]

Passed ", "", type="no-link"})) |-

||&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]] || |- ||&nbsp;[[Kategori:Wiktionary:Sidor med tomma celler]]

Passed ", "-", type="no-link"})) |-

||– || |- ||–

Passed ", "?", type="no-link"})) |-

||? || |- ||?

Text Expected Actual
test_08_words_containg_special_chars:
Failed mut.getRow("e-post") |-

||<span class="infl">[[e-post]]</span> || |- ||<span data-grammar-link="infl">[[e-post]]</span>

Failed mut.getRow("word's") |-

||<span class="infl">[[word's]]</span> || |- ||<span data-grammar-link="infl">[[word's]]</span>

Failed mut.getRow("words'") |-

||<span class="infl">[[words']]</span> || |- ||<span data-grammar-link="infl">[[words']]</span>

Failed mut.getRow("tv:n") |-

||<span class="infl">[[tv:n]]</span> || |- ||<span data-grammar-link="infl">[[tv:n]]</span>

Failed mut.getRow("]") |-

||<span class="infl">[[Övriga_uppslagsord#EU:s|EU:s]]</span> || |- ||<span data-grammar-link="infl">[[Övriga_uppslagsord#EU:s|EU:s]]</span>

Failed mut.getRow("'']''") |-

||''<span class="infl">[]</span>'' || |- ||''<span data-grammar-link="infl">[]</span>''

Text Expected Actual
test_09_basic_with_lang_code:
Passed mut.setLanguage("de") (nil) (nil)
Failed 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>

Failed 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>

Failed 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!|&nbsp;\n|rowspan="2"|&nbsp;]\n|class="min"|&nbsp;]\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!|&nbsp;\n|rowspan="2"|&nbsp;]\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||&nbsp;]\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||&nbsp;]\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||&nbsp;]\n'), {nowiki=1})
	self:equals('mut.getRow({"|", "", type="no-link"}))', nowiki(mut.getRow({"|", "", type="no-link"})), nowiki('|-\n||&nbsp;]\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