<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ATemplate_invocation%2Ftestcases</id>
	<title>Module:Template invocation/testcases - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://stockhub.co/index.php?action=history&amp;feed=atom&amp;title=Module%3ATemplate_invocation%2Ftestcases"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Template_invocation/testcases&amp;action=history"/>
	<updated>2026-06-13T16:06:03Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://stockhub.co/index.php?title=Module:Template_invocation/testcases&amp;diff=147224&amp;oldid=prev</id>
		<title>imported&gt;Andrybak: fix expected values</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Template_invocation/testcases&amp;diff=147224&amp;oldid=prev"/>
		<updated>2020-05-23T09:42:03Z</updated>

		<summary type="html">&lt;p&gt;fix expected values&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Unit tests for [[Module:Template invocation]]. Click talk page to run tests.&lt;br /&gt;
local ScribuntoUnit = require(&amp;#039;Module:ScribuntoUnit&amp;#039;)&lt;br /&gt;
local p = ScribuntoUnit:new()&lt;br /&gt;
local protect = require(&amp;#039;Module:Protect&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local function nw(o)&lt;br /&gt;
	return mw.text.nowiki(tostring(o))&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function test(a, expected)&lt;br /&gt;
	local mTemplateInvocation = require(&amp;#039;Module:Template invocation&amp;#039;)&lt;br /&gt;
	local mTemplateInvocation2 = require(&amp;#039;Module:Template invocation/sandbox&amp;#039;)&lt;br /&gt;
	local liveRes = protect(mTemplateInvocation.invocation)(&amp;#039;foo&amp;#039;, a)&lt;br /&gt;
	local sandboxRes = protect(mTemplateInvocation2.invocation)(&amp;#039;foo&amp;#039;, a)&lt;br /&gt;
	local message = &amp;#039;Expected &amp;#039; .. nw(expected) .. &amp;#039;. Got &amp;#039;&lt;br /&gt;
	p:assertEquals(expected, liveRes, message .. nw(liveRes) .. &amp;#039; from live module.&amp;#039;)&lt;br /&gt;
	p:assertEquals(expected, sandboxRes, message .. nw(sandboxRes) .. &amp;#039; from sandbox.&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p:test_hello()&lt;br /&gt;
	local a = {&amp;#039;bar&amp;#039;, &amp;#039;baz&amp;#039;, abc = &amp;#039;def&amp;#039;}; a[6]=666; a[7]=777; a[&amp;#039;7&amp;#039;]=&amp;#039;777s&amp;#039;; a[3]=333; a[&amp;#039;4&amp;#039;]=&amp;#039;444s&amp;#039;&lt;br /&gt;
	return test(a, &amp;#039;{{foo|bar|baz|333|6=666|7=777|4=444s|7=777s|abc=def}}&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p:test_equals_sign()&lt;br /&gt;
	local a = {&amp;#039;bar&amp;#039;, &amp;#039;baz&amp;#039;, &amp;#039;{{=}}&amp;#039;}&lt;br /&gt;
	return test(a, &amp;#039;{{foo|bar|baz|3={{=}}}}&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p:test_numbered()&lt;br /&gt;
	local a = {}&lt;br /&gt;
	a[1] = &amp;#039;aaa&amp;#039;&lt;br /&gt;
	a[2] = &amp;#039;bbb&amp;#039;&lt;br /&gt;
	a[5] = &amp;#039;eee&amp;#039;&lt;br /&gt;
	return test(a, &amp;#039;{{foo|aaa|bbb|5=eee}}&amp;#039;)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Andrybak</name></author>
	</entry>
</feed>