All tests passed. (refresh)

Text Expected Actual
test01a_basic:
Passed mut.link("form1", "infl") <span data-grammar-link="infl">[[form1]]</span> <span data-grammar-link="infl">[[form1]]</span>
Passed mut.link(" form1 ", "infl") <span data-grammar-link="infl">[[form1]]</span> <span data-grammar-link="infl">[[form1]]</span>
Passed mut.link("form1", "infl", "sv") <span data-grammar-link="infl">[[form1#Svenska|form1]]</span> <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>
Passed mut.link("form1", "infl", "sv", "verb) <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span></span> <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span></span>
Passed mut.link("form1", "adv") <span data-grammar-link="adv">[[form1]]</span> <span data-grammar-link="adv">[[form1]]</span>
Passed mut.link("form1", "adv", "de") <span data-grammar-link="adv">[[form1#Tyska|form1]]</span> <span data-grammar-link="adv">[[form1#Tyska|form1]]</span>
Passed mut.link("form1", "adv", "de", "verb) <span class="grammar-inline" data-lang="de" data-h3="verb"><span data-grammar-link="adv">[[form1#Tyska|form1]]</span></span> <span class="grammar-inline" data-lang="de" data-h3="verb"><span data-grammar-link="adv">[[form1#Tyska|form1]]</span></span>
Passed mut.link("form1", "perfpart") <span data-grammar-link="perfpart">[[form1]]</span> <span data-grammar-link="perfpart">[[form1]]</span>
Passed mut.link("form1", "perfpart", "en") <span data-grammar-link="perfpart">[[form1#Engelska|form1]]</span> <span data-grammar-link="perfpart">[[form1#Engelska|form1]]</span>
Passed mut.link("form1", "perfpart", "en", "verb) <span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="perfpart">[[form1#Engelska|form1]]</span></span> <span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="perfpart">[[form1#Engelska|form1]]</span></span>
Text Expected Actual
test01b_basic_export:
Passed mut.linkExport("form1", "infl") {"form1"} {"form1"}
Passed mut.linkExport("form1", "adv") {"form1"} {"form1"}
Passed mut.linkExport("form1", "perfpart") {"form1"} {"form1"}
Passed mut.linkExport(" form1 ", "infl") {"form1"} {"form1"}
Text Expected Actual
test02a_multiple:
Passed mut.link("form1, form2", "infl") <span data-grammar-link="infl">[[form1]]</span>, <span data-grammar-link="infl">[[form2]]</span> <span data-grammar-link="infl">[[form1]]</span>, <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("form1, form2", "infl", "sv") <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span> <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span>
Passed mut.link("form1, form2", "infl", "sv", "verb) <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span></span> <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span></span>
Passed mut.link("[[form1]], [[form2]]", "infl") <span data-grammar-link="infl">[[form1]]</span>, <span data-grammar-link="infl">[[form2]]</span> <span data-grammar-link="infl">[[form1]]</span>, <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("[[form1]], [[form2]]", "infl", "sv") <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span> <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span>
Passed mut.link("[[form1]], [[form2]]", "infl", "sv", "verb") <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span></span> <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span></span>
Passed mut.link("[[form1]], form2", "infl") <span data-grammar-link="infl">[[form1]]</span>, <span data-grammar-link="infl">[[form2]]</span> <span data-grammar-link="infl">[[form1]]</span>, <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("[[form1]], form2", "infl", "sv") <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span> <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span>
Passed mut.link("[[form1]], form2", "infl", "sv", "verb") <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span></span> <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span></span>
Passed mut.link("form1, [[form2]]", "infl") <span data-grammar-link="infl">[[form1]]</span>, <span data-grammar-link="infl">[[form2]]</span> <span data-grammar-link="infl">[[form1]]</span>, <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("form1, [[form2]]", "infl", "sv") <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span> <span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span>
Passed mut.link("form1, [[form2]]", "infl", "sv", "verb") <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span></span> <span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">[[form1#Svenska|form1]]</span>, <span data-grammar-link="infl">[[form2#Svenska|form2]]</span></span>
Text Expected Actual
test02b_multiple_export:
Passed mut.linkExport("form1, form2", "infl") {"form1", "form2"} {"form1", "form2"}
Passed mut.linkExport("[[form1]], [[form2]]", "infl") {"form1", "form2"} {"form1", "form2"}
Passed mut.linkExport("[[form1]], form2", "infl") {"form1", "form2"} {"form1", "form2"}
Passed mut.linkExport("form1, [[form2]]", "infl") {"form1", "form2"} {"form1", "form2"}
Text Expected Actual
test03a_misc:
Passed mut.link("[[form1]]<sup>1</sup>") <span data-grammar-link="infl">[[form1]]</span><sup>1</sup> <span data-grammar-link="infl">[[form1]]</span><sup>1</sup>
Passed mut.link("[[form1]], vard. [[form2]]") <span data-grammar-link="infl">[[form1]]</span>, vard. <span data-grammar-link="infl">[[form2]]</span> <span data-grammar-link="infl">[[form1]]</span>, vard. <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("([[form1]])") '''('''<span data-grammar-link="infl">[[form1]]</span>''')''' '''('''<span data-grammar-link="infl">[[form1]]</span>''')'''
Passed mut.link("[[form1|fōrm1]]") <span data-grammar-link="infl">[[form1|fōrm1]]</span> <span data-grammar-link="infl">[[form1|fōrm1]]</span>
Passed mut.link("[[Övriga_uppslagsord#EU:s|EU:s]]") <span data-grammar-link="infl">[[Övriga_uppslagsord#EU:s|EU:s]]</span> <span data-grammar-link="infl">[[Övriga_uppslagsord#EU:s|EU:s]]</span>
Passed mut.link("<nowiki/>form1, form2")
Med nowiki i modul
<nowiki/>form1, <span data-grammar-link="infl">[[form2]]</span> <nowiki/>form1, <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("<nowiki/>form1, form2")
Med nowiki i mall
"`UNIQ--nowiki-00000001-QINU`"'form1, <span data-grammar-link="infl">[[form2]]</span> "`UNIQ--nowiki-00000001-QINU`"'form1, <span data-grammar-link="infl">[[form2]]</span>
Text Expected Actual
test03b_misc_export:
Passed mut.linkExport("[[form1]]<sup>1</sup>") {"form1"} {"form1"}
Passed mut.linkExport("[[form1]], vard. [[form2]]") {"form1", "form2"} {"form1", "form2"}
Passed mut.linkExport("([[form1]])") {"(form1)"} {"(form1)"}
Passed mut.linkExport("[[form1|fōrm1]]") {"fōrm1"} {"fōrm1"}
Passed mut.linkExport("[[Övriga_uppslagsord#EU:s|EU:s]]") {"EU:s"} {"EU:s"}
Passed mut.linkExport("<nowiki/>form1, form2")
Med nowiki i modul
{"form2"} {"form2"}
Passed mut.linkExport("<nowiki/>form1, form2")
Med nowiki i mall
{"form2"} {"form2"}
Text Expected Actual
test04a_do_not_link:
Passed mut.link("ord1 ord2", "infl") ord1 ord2 ord1 ord2
Passed mut.link("noform", "no-link") noform noform
Text Expected Actual
test04b_do_not_link_export:
Passed mut.linkExport("ord1 ord2", "infl") {"ord1 ord2"} {"ord1 ord2"}
Passed mut.linkExport("noform", "no-link") {} {}
Text Expected Actual
test05a_link_but_no_tag:
Passed mut.link("noform1", "link-only") [[noform1]] [[noform1]]
Passed mut.link("noform1, noform2", "link-only") [[noform1]], [[noform2]] [[noform1]], [[noform2]]
Passed mut.link("[[noform1]], noform2", "link-only") [[noform1]], [[noform2]] [[noform1]], [[noform2]]
Text Expected Actual
test05b_link_but_no_tag_export:
Passed mut.linkExport("noform1", "link-only") {} {}
Passed mut.linkExport("noform1, noform2", "link-only") {} {}
Passed mut.linkExport("[[noform1]], noform2", "link-only") {} {}
Text Expected Actual
test06a_special_cases:
Passed mut.link("", "infl") &nbsp; &nbsp;
Passed mut.link("", "no-link") &nbsp; &nbsp;
Passed mut.link("", "link-only") &nbsp; &nbsp;
Passed mut.link("-", "infl")
Passed mut.link("-", "no-link")
Passed mut.link("-", "link-only")
Passed mut.link("?", "infl") ? ?
Passed mut.link("?", "no-link") ? ?
Passed mut.link("?", "link-only") ? ?
Text Expected Actual
test06b_special_cases_export:
Passed mut.linkExport("", "infl") {} {}
Passed mut.linkExport("", "no-link") {} {}
Passed mut.linkExport("", "link-only") {} {}
Passed mut.linkExport("-", "infl") {} {}
Passed mut.linkExport("-", "no-link") {} {}
Passed mut.linkExport("-", "link-only") {} {}
Passed mut.linkExport("?", "infl") {} {}
Passed mut.linkExport("?", "no-link") {} {}
Passed mut.linkExport("?", "link-only") {} {}
Text Expected Actual
test_07a_maybe_slightly:
Passed mut.link("(form1)", "infl") '''('''<span data-grammar-link="infl">[[form1]]</span>''')''' '''('''<span data-grammar-link="infl">[[form1]]</span>''')'''
Passed mut.link("form1?", "infl") '''('''form1''')?''' '''('''form1''')?'''
Passed mut.link(" form1? ", "infl") '''('''form1''')?''' '''('''form1''')?'''
Passed mut.link("(form1), form2", "infl") '''('''<span data-grammar-link="infl">[[form1]]</span>''')''', <span data-grammar-link="infl">[[form2]]</span> '''('''<span data-grammar-link="infl">[[form1]]</span>''')''', <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("form1?, form2", "infl") '''('''form1''')?''', <span data-grammar-link="infl">[[form2]]</span> '''('''form1''')?''', <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("(form1), [[form2]]", "infl") '''('''<span data-grammar-link="infl">[[form1]]</span>''')''', <span data-grammar-link="infl">[[form2]]</span> '''('''<span data-grammar-link="infl">[[form1]]</span>''')''', <span data-grammar-link="infl">[[form2]]</span>
Passed mut.link("form1?, [[form2]]", "infl") '''('''form1''')?''', <span data-grammar-link="infl">[[form2]]</span> '''('''form1''')?''', <span data-grammar-link="infl">[[form2]]</span>
Text Expected Actual
test_07b_maybe_slightly_export:
Passed mut.linkExport("(form1)", "infl") {"(form1)"} {"(form1)"}
Passed mut.linkExport("form1?", "infl") {"form1?"} {"form1?"}
Passed mut.linkExport(" form1? ", "infl") {"form1?"} {"form1?"}
Passed mut.linkExport("(form1), form2", "infl") {"(form1)", "form2"} {"(form1)", "form2"}
Passed mut.linkExport("form1?, form2", "infl") {"form1?", "form2"} {"form1?", "form2"}
Passed mut.linkExport("(form1), [[form2]]", "infl") {"(form1)", "form2"} {"(form1)", "form2"}
Passed mut.linkExport("form1?, [[form2]]", "infl") {"form1?", "form2"} {"form1?", "form2"}
Text Expected Actual
test_08_do_not_add_anchor_if_pagename_equals_inflection:
Passed mut.link("grammar-link/test", "infl", "en", "verb") <span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[grammar-link/test]]</span></span> <span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[grammar-link/test]]</span></span>
Passed mut.link("[[grammar-link/test]]", "infl", "en", "verb") <span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[grammar-link/test]]</span></span> <span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[grammar-link/test]]</span></span>
Passed mut.link("[[grammar-link/test]], [[grammar-link/test]]", "infl", "en", "verb") <span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[grammar-link/test]]</span></span> <span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[grammar-link/test]]</span></span>
local t = require("Modul:UnitTests")
local lk = require("Modul:link")
local mut = require("Modul:grammar-link")

local nowiki = function(s)
	return s:gsub('[\r\n][!]', {["\n!"] = "\n !", ["\r!"] = "\r !"})
end

function t:test01a_basic()
	self:equals('mut.link("form1", "infl")', mut.link("form1", "infl"), '<span data-grammar-link="infl">' .. lk.link("form1") .. '</span>', {nowiki=1})
	self:equals('mut.link(" form1 ", "infl")', mut.link(" form1 ", "infl"), '<span data-grammar-link="infl">' .. lk.link("form1") .. '</span>', {nowiki=1})
	self:equals('mut.link("form1", "infl", "sv")', mut.link("form1", "infl", "sv"), '<span data-grammar-link="infl">' .. lk.link("form1", "sv") .. '</span>', {nowiki=1})
	self:equals('mut.link("form1", "infl", "sv", "verb)', mut.link("form1", "infl", "sv", "verb"), '<span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">' .. lk.link("form1", "sv") .. '</span></span>', {nowiki=1})
	self:equals('mut.link("form1", "adv")', mut.link("form1", "adv"), '<span data-grammar-link="adv">' .. lk.link("form1") .. '</span>', {nowiki=1})
	self:equals('mut.link("form1", "adv", "de")', mut.link("form1", "adv", "de"), '<span data-grammar-link="adv">' .. lk.link("form1", "de") .. '</span>', {nowiki=1})
	self:equals('mut.link("form1", "adv", "de", "verb)', mut.link("form1", "adv", "de", "verb"), '<span class="grammar-inline" data-lang="de" data-h3="verb"><span data-grammar-link="adv">' .. lk.link("form1", "de") .. '</span></span>', {nowiki=1})
	self:equals('mut.link("form1", "perfpart")', mut.link("form1", "perfpart"), '<span data-grammar-link="perfpart">' .. lk.link("form1") .. '</span>', {nowiki=1})
	self:equals('mut.link("form1", "perfpart", "en")', mut.link("form1", "perfpart", "en"), '<span data-grammar-link="perfpart">' .. lk.link("form1", "en") .. '</span>', {nowiki=1})
	self:equals('mut.link("form1", "perfpart", "en", "verb)', mut.link("form1", "perfpart", "en", "verb"), '<span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="perfpart">' .. lk.link("form1", "en") .. '</span></span>', {nowiki=1})
end

function t:test01b_basic_export()
	self:equals_deep('mut.linkExport("form1", "infl")', mut.linkExport("form1", "infl"), {"form1"}, {nowiki=1})
	self:equals_deep('mut.linkExport("form1", "adv")', mut.linkExport("form1", "adv"), {"form1"}, {nowiki=1})
	self:equals_deep('mut.linkExport("form1", "perfpart")', mut.linkExport("form1", "perfpart"), {"form1"}, {nowiki=1})
	self:equals_deep('mut.linkExport(" form1 ", "infl")', mut.linkExport(" form1 ", "infl"), {"form1"}, {nowiki=1})
end

function t:test02a_multiple()
	self:equals('mut.link("form1, form2", "infl")', mut.link("form1, form2", "infl"), '<span data-grammar-link="infl">' .. lk.link("form1") .. '</span>, <span data-grammar-link="infl">' .. lk.link("form2") .. '</span>', {nowiki=1})
	self:equals('mut.link("form1, form2", "infl", "sv")', mut.link("form1, form2", "infl", "sv"), '<span data-grammar-link="infl">' .. lk.link("form1", "sv") .. '</span>, <span data-grammar-link="infl">' .. lk.link("form2", "sv") .. '</span>', {nowiki=1})
	self:equals('mut.link("form1, form2", "infl", "sv", "verb)', mut.link("form1, form2", "infl", "sv", "verb"), '<span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">' .. lk.link("form1", "sv") .. '</span>, <span data-grammar-link="infl">' .. lk.link("form2", "sv") .. '</span></span>', {nowiki=1})
	self:equals('<nowiki>mut.link("[[form1]], [[form2]]", "infl"</nowiki>)', mut.link("[[form1]], [[form2]]", "infl"), '<span data-grammar-link="infl">' .. lk.link("[[form1]]") .. '</span>, <span data-grammar-link="infl">' .. lk.link("[[form2]]") .. '</span>', {nowiki=1})
	self:equals('<nowiki>mut.link("[[form1]], [[form2]]", "infl", "sv"</nowiki>)', mut.link("[[form1]], [[form2]]", "infl", "sv"), '<span data-grammar-link="infl">' .. lk.link("[[form1]]", "sv") .. '</span>, <span data-grammar-link="infl">' .. lk.link("[[form2]]", "sv") .. '</span>', {nowiki=1})
	self:equals('<nowiki>mut.link("[[form1]], [[form2]]", "infl", "sv", "verb"</nowiki>)', mut.link("[[form1]], [[form2]]", "infl", "sv", "verb"), '<span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">' .. lk.link("[[form1]]", "sv") .. '</span>, <span data-grammar-link="infl">' .. lk.link("[[form2]]", "sv") .. '</span></span>', {nowiki=1})
	self:equals('<nowiki>mut.link("[[form1]], form2", "infl"</nowiki>)', mut.link("[[form1]], form2", "infl"), '<span data-grammar-link="infl">' .. lk.link("[[form1]]") .. '</span>, <span data-grammar-link="infl">' .. lk.link("form2") .. '</span>', {nowiki=1})
	self:equals('<nowiki>mut.link("[[form1]], form2", "infl", "sv"</nowiki>)', mut.link("[[form1]], form2", "infl", "sv"), '<span data-grammar-link="infl">' .. lk.link("[[form1]]", "sv") .. '</span>, <span data-grammar-link="infl">' .. lk.link("form2", "sv") .. '</span>', {nowiki=1})
	self:equals('<nowiki>mut.link("[[form1]], form2", "infl", "sv", "verb"</nowiki>)', mut.link("[[form1]], form2", "infl", "sv", "verb"), '<span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">' .. lk.link("[[form1]]", "sv") .. '</span>, <span data-grammar-link="infl">' .. lk.link("form2", "sv") .. '</span></span>', {nowiki=1})
	self:equals('<nowiki>mut.link("form1, [[form2]]", "infl"</nowiki>)', mut.link("form1, [[form2]]", "infl"), '<span data-grammar-link="infl">' .. lk.link("form1") .. '</span>, <span data-grammar-link="infl">' .. lk.link("[[form2]]") .. '</span>', {nowiki=1})
	self:equals('<nowiki>mut.link("form1, [[form2]]", "infl", "sv"</nowiki>)', mut.link("form1, [[form2]]", "infl", "sv"), '<span data-grammar-link="infl">' .. lk.link("form1", "sv") .. '</span>, <span data-grammar-link="infl">' .. lk.link("[[form2]]", "sv") .. '</span>', {nowiki=1})
	self:equals('<nowiki>mut.link("form1, [[form2]]", "infl", "sv", "verb"</nowiki>)', mut.link("form1, [[form2]]", "infl", "sv", "verb"), '<span class="grammar-inline" data-lang="sv" data-h3="verb"><span data-grammar-link="infl">' .. lk.link("form1", "sv") .. '</span>, <span data-grammar-link="infl">' .. lk.link("[[form2]]", "sv") .. '</span></span>', {nowiki=1})
end

function t:test02b_multiple_export()
	self:equals_deep('mut.linkExport("form1, form2", "infl")', mut.linkExport("form1, form2", "infl"), {"form1", "form2"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("[[form1]], [[form2]]", "infl"</nowiki>)', mut.linkExport("[[form1]], [[form2]]", "infl"), {"form1", "form2"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("[[form1]], form2", "infl"</nowiki>)', mut.linkExport("[[form1]], form2", "infl"), {"form1", "form2"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("form1, [[form2]]", "infl"</nowiki>)', mut.linkExport("form1, [[form2]]", "infl"), {"form1", "form2"}, {nowiki=1})
end

function t:test03a_misc()
	self:equals('<nowiki>mut.link("[[form1]]<sup>1</sup>")</nowiki>', mut.link("[[form1]]<sup>1</sup>", "infl"), '<span data-grammar-link="infl">' .. lk.link("[[form1]]") .. '</span><sup>1</sup>', {nowiki=1})
	self:equals('<nowiki>mut.link("[[form1]], vard. [[form2]]")</nowiki>', mut.link("[[form1]], vard. [[form2]]", "infl"), '<span data-grammar-link="infl">' .. lk.link("[[form1]]") .. '</span>, vard. <span data-grammar-link="infl">' .. lk.link("[[form2]]") .. '</span>', {nowiki=1})
	self:equals('<nowiki>mut.link("([[form1]])")</nowiki>', mut.link("([[form1]])", "infl"), [=['''('''<span data-grammar-link="infl">]=] .. lk.link("[[form1]]") .. [=[</span>''')''']=], {nowiki=1})
	self:equals('<nowiki>mut.link("[[form1|fōrm1]]")</nowiki>', mut.link("[[form1|fōrm1]]", "infl"), '<span data-grammar-link="infl">' .. lk.link("[[form1|fōrm1]]") .. '</span>', {nowiki=1})
	self:equals('<nowiki>mut.link("[[Övriga_uppslagsord#EU:s|EU:s]]")</nowiki>', mut.link("[[Övriga_uppslagsord#EU:s|EU:s]]", "infl"), '<span data-grammar-link="infl">' .. lk.link("[[Övriga_uppslagsord#EU:s|EU:s]]") .. '</span>', {nowiki=1})
	--self:equals('<nowiki>mut.link("[[form1]]<ref>[[Källa]]</ref>")</nowiki>', mut.link("[[form1]]<ref>[[Källa]]</ref>", "infl"), '<span data-grammar-link="infl">' .. lk.link("[[form1]]") .. '</span><ref>[[Källa]]</ref>', {nowiki=1}) -- inaktiverad tills vi vet hur vi vill ha det
	self:equals([[<nowiki>mut.link("<nowiki/>form1, form2")</nowiki><br>''Med nowiki i modul'']], mut.link("<nowiki/>form1, form2", "infl"), '<nowiki/>form1, <span data-grammar-link="infl">' .. lk.link("[[form2]]") .. '</span>', {nowiki=1})
	local uniq_nowiki = "\127\"`UNIQ--nowiki-00000001-QINU`\"'\127"
	self:equals([[<nowiki>mut.link("<nowiki/>form1, form2")</nowiki><br>''Med nowiki i mall'']], mut.link(uniq_nowiki .. "form1, form2", "infl"), uniq_nowiki .. 'form1, <span data-grammar-link="infl">' .. lk.link("[[form2]]") .. '</span>', {nowiki=1})
end

function t:test03b_misc_export()
	self:equals_deep('<nowiki>mut.linkExport("[[form1]]<sup>1</sup>")</nowiki>', mut.linkExport("[[form1]]<sup>1</sup>", "infl"), {"form1"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("[[form1]], vard. [[form2]]")</nowiki>', mut.linkExport("[[form1]], vard. [[form2]]", "infl"), {"form1", "form2"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("([[form1]])")</nowiki>', mut.linkExport("([[form1]])", "infl"), {"(form1)"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("[[form1|fōrm1]]")</nowiki>', mut.linkExport("[[form1|fōrm1]]", "infl"), {"fōrm1"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("[[Övriga_uppslagsord#EU:s|EU:s]]")</nowiki>', mut.linkExport("[[Övriga_uppslagsord#EU:s|EU:s]]", "infl"), {"EU:s"}, {nowiki=1})
	self:equals_deep([[<nowiki>mut.linkExport("<nowiki/>form1, form2")</nowiki><br>''Med nowiki i modul'']], mut.linkExport("<nowiki/>form1, form2", "infl"), {"form2"}, {nowiki=1})
	local uniq_nowiki = "\127\"`UNIQ--nowiki-00000001-QINU`\"'\127"
	self:equals_deep([[<nowiki>mut.linkExport("<nowiki/>form1, form2")</nowiki><br>''Med nowiki i mall'']], mut.linkExport(uniq_nowiki .. "form1, form2", "infl"), {"form2"}, {nowiki=1})
end

function t:test04a_do_not_link()
	self:equals('mut.link("ord1 ord2", "infl")', mut.link("ord1 ord2", "infl"), "ord1 ord2", {nowiki=1})
	self:equals('mut.link("noform", "no-link")', mut.link("noform", "no-link"), "noform", {nowiki=1})
end

function t:test04b_do_not_link_export()
	self:equals_deep('mut.linkExport("ord1 ord2", "infl")', mut.linkExport("ord1 ord2", "infl"), {"ord1 ord2"}, {nowiki=1})
	self:equals_deep('mut.linkExport("noform", "no-link")', mut.linkExport("noform", "no-link"), {}, {nowiki=1})
end

function t:test05a_link_but_no_tag()
	self:equals('<nowiki>mut.link("noform1", "link-only")</nowiki>', mut.link("noform1", "link-only"), lk.link("noform1"), {nowiki=1})
	self:equals('<nowiki>mut.link("noform1, noform2", "link-only")</nowiki>', mut.link("noform1, noform2", "link-only"), lk.link("noform1, noform2"), {nowiki=1})
	self:equals('<nowiki>mut.link("[[noform1]], noform2", "link-only")</nowiki>', mut.link("[[noform1]], noform2", "link-only"), lk.link("[[noform1]], noform2"), {nowiki=1})
end

function t:test05b_link_but_no_tag_export()
	self:equals_deep('<nowiki>mut.linkExport("noform1", "link-only")</nowiki>', mut.linkExport("noform1", "link-only"), {}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("noform1, noform2", "link-only")</nowiki>', mut.linkExport("noform1, noform2", "link-only"), {}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("[[noform1]], noform2", "link-only")</nowiki>', mut.linkExport("[[noform1]], noform2", "link-only"), {}, {nowiki=1})
end

function t:test06a_special_cases()
	self:equals('mut.link("", "infl")', mut.link("", "infl"), "&nbsp;", {nowiki=1})
	self:equals('mut.link("", "no-link")', mut.link("", "no-link"), "&nbsp;", {nowiki=1})
	self:equals('mut.link("", "link-only")', mut.link("", "link-only"), "&nbsp;", {nowiki=1})
	self:equals('mut.link("-", "infl")', mut.link("-", "infl"), "–", {nowiki=1})
	self:equals('mut.link("-", "no-link")', mut.link("-", "no-link"), "–", {nowiki=1})
	self:equals('mut.link("-", "link-only")', mut.link("-", "link-only"), "–", {nowiki=1})
	self:equals('mut.link("?", "infl")', mut.link("?", "infl"), "?", {nowiki=1})
	self:equals('mut.link("?", "no-link")', mut.link("?", "no-link"), "?", {nowiki=1})
	self:equals('mut.link("?", "link-only")', mut.link("?", "link-only"), "?", {nowiki=1})
end

function t:test06b_special_cases_export()
	self:equals_deep('mut.linkExport("", "infl")', mut.linkExport("", "infl"), {}, {nowiki=1})
	self:equals_deep('mut.linkExport("", "no-link")', mut.linkExport("", "no-link"), {}, {nowiki=1})
	self:equals_deep('mut.linkExport("", "link-only")', mut.linkExport("", "link-only"), {}, {nowiki=1})
	self:equals_deep('mut.linkExport("-", "infl")', mut.linkExport("-", "infl"), {}, {nowiki=1})
	self:equals_deep('mut.linkExport("-", "no-link")', mut.linkExport("-", "no-link"), {}, {nowiki=1})
	self:equals_deep('mut.linkExport("-", "link-only")', mut.linkExport("-", "link-only"), {}, {nowiki=1})
	self:equals_deep('mut.linkExport("?", "infl")', mut.linkExport("?", "infl"), {}, {nowiki=1})
	self:equals_deep('mut.linkExport("?", "no-link")', mut.linkExport("?", "no-link"), {}, {nowiki=1})
	self:equals_deep('mut.linkExport("?", "link-only")', mut.linkExport("?", "link-only"), {}, {nowiki=1})
end

function t:test_07a_maybe_slightly()
	self:equals('mut.link("(form1)", "infl")', mut.link("(form1)", "infl"), "'''('''" .. mut.link("form1", "infl") .. "''')'''", {nowiki=1})
	self:equals('mut.link("form1?", "infl")', mut.link("form1?", "infl"), "'''('''form1''')?'''", {nowiki=1})
	self:equals('mut.link(" form1? ", "infl")', mut.link(" form1? ", "infl"), "'''('''form1''')?'''", {nowiki=1})
	self:equals('mut.link("(form1), form2", "infl")', mut.link("(form1), form2", "infl"), "'''('''" .. mut.link("form1", "infl") .. "''')''', " .. mut.link("form2", "infl"), {nowiki=1})
	self:equals('mut.link("form1?, form2", "infl")', mut.link("form1?, form2", "infl"), "'''('''form1''')?''', " .. mut.link("form2", "infl"), {nowiki=1})
	self:equals('<nowiki>mut.link("(form1), [[form2]]", "infl")</nowiki>', mut.link("(form1), [[form2]]", "infl"), "'''('''" .. mut.link("form1", "infl") .. "''')''', " .. mut.link("form2", "infl"), {nowiki=1})
	self:equals('<nowiki>mut.link("form1?, [[form2]]", "infl")</nowiki>', mut.link("form1?, [[form2]]", "infl"), "'''('''form1''')?''', " .. mut.link("form2", "infl"), {nowiki=1})
end

function t:test_07b_maybe_slightly_export()
	self:equals_deep('mut.linkExport("(form1)", "infl")', mut.linkExport("(form1)", "infl"), {"(form1)"}, {nowiki=1})
	self:equals_deep('mut.linkExport("form1?", "infl")', mut.linkExport("form1?", "infl"), {"form1?"}, {nowiki=1})
	self:equals_deep('mut.linkExport(" form1? ", "infl")', mut.linkExport(" form1? ", "infl"), {"form1?"}, {nowiki=1})
	self:equals_deep('mut.linkExport("(form1), form2", "infl")', mut.linkExport("(form1), form2", "infl"), {"(form1)", "form2"}, {nowiki=1})
	self:equals_deep('mut.linkExport("form1?, form2", "infl")', mut.linkExport("form1?, form2", "infl"), {"form1?", "form2"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("(form1), [[form2]]", "infl")</nowiki>', mut.linkExport("(form1), [[form2]]", "infl"), {"(form1)", "form2"}, {nowiki=1})
	self:equals_deep('<nowiki>mut.linkExport("form1?, [[form2]]", "infl")</nowiki>', mut.linkExport("form1?, [[form2]]", "infl"), {"form1?", "form2"}, {nowiki=1})
end

function t:test_08_do_not_add_anchor_if_pagename_equals_inflection()
	self:equals('mut.link("<nowiki>' .. mw.title.getCurrentTitle().text .. '", "infl", "en", "verb</nowiki>")', mut.link(mw.title.getCurrentTitle().text, "infl", "en", "verb"), '<span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[' .. mw.title.getCurrentTitle().text .. ']]</span></span>', {nowiki=1})
	self:equals('mut.link("<nowiki>[[' .. mw.title.getCurrentTitle().text .. ']]", "infl", "en", "verb</nowiki>")', mut.link(mw.title.getCurrentTitle().text, "infl", "en", "verb"), '<span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[' .. mw.title.getCurrentTitle().text .. ']]</span></span>', {nowiki=1})
	self:equals('mut.link("<nowiki>[[' .. mw.title.getCurrentTitle().text .. ']], [[' .. mw.title.getCurrentTitle().text .. ']]", "infl", "en", "verb</nowiki>")', mut.link(mw.title.getCurrentTitle().text, "infl", "en", "verb"), '<span class="grammar-inline" data-lang="en" data-h3="verb"><span data-grammar-link="infl">[[' .. mw.title.getCurrentTitle().text .. ']]</span></span>', {nowiki=1})
end

return t