<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.stiles.casa/index.php?action=history&amp;feed=atom&amp;title=Module%3AIcon%2Ftestcases</id>
	<title>Module:Icon/testcases - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.stiles.casa/index.php?action=history&amp;feed=atom&amp;title=Module%3AIcon%2Ftestcases"/>
	<link rel="alternate" type="text/html" href="https://wiki.stiles.casa/index.php?title=Module:Icon/testcases&amp;action=history"/>
	<updated>2026-04-07T11:06:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://wiki.stiles.casa/index.php?title=Module:Icon/testcases&amp;diff=6696&amp;oldid=prev</id>
		<title>imported&gt;Mr. Stradivarius: use descriptive sentences for test cases, and generate the test data table every time, just in case the main module does something funny with it</title>
		<link rel="alternate" type="text/html" href="https://wiki.stiles.casa/index.php?title=Module:Icon/testcases&amp;diff=6696&amp;oldid=prev"/>
		<updated>2021-08-29T06:12:51Z</updated>

		<summary type="html">&lt;p&gt;use descriptive sentences for test cases, and generate the test data table every time, just in case the main module does something funny with it&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local mIcon = require(&amp;#039;Module:Icon/sandbox&amp;#039;)&lt;br /&gt;
local ScribuntoUnit = require(&amp;#039;Module:ScribuntoUnit&amp;#039;)&lt;br /&gt;
local suite = ScribuntoUnit:new()&lt;br /&gt;
&lt;br /&gt;
-- Use a shortcut function to call mIcon._main using custom icon data.&lt;br /&gt;
local function icon(args)&lt;br /&gt;
	local data = {&lt;br /&gt;
		fa = {&lt;br /&gt;
			image = &amp;quot;Featured article star.svg&amp;quot;,&lt;br /&gt;
			tooltip = &amp;quot;Featured article&amp;quot;,&lt;br /&gt;
			link = true,&lt;br /&gt;
		},&lt;br /&gt;
		ga = {&lt;br /&gt;
			image = &amp;quot;Symbol support vote.svg&amp;quot;,&lt;br /&gt;
			tooltip = &amp;quot;Good article&amp;quot;,&lt;br /&gt;
			link = false,&lt;br /&gt;
		},&lt;br /&gt;
		stiles.casa_wiki = {&lt;br /&gt;
			image = &amp;quot;Stiles.casa Wiki-logo.svg&amp;quot;,&lt;br /&gt;
			tooltip = &amp;quot;Stiles.casa Wiki page&amp;quot;,&lt;br /&gt;
		},&lt;br /&gt;
		_DEFAULT = {&lt;br /&gt;
			image = &amp;quot;Symbol question.svg&amp;quot;,&lt;br /&gt;
			link = false,&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	return mIcon._main(args, data)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function suite:assertIsFileLink(s)&lt;br /&gt;
	self:assertStringContains(&amp;#039;^%[%[File:[^%]]+%]%]$&amp;#039;, s)&lt;br /&gt;
	self:assertStringContains(&amp;#039;|class=noviewer&amp;#039;, s, true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local linkPattern = &amp;#039;|link=[|%]]&amp;#039;&lt;br /&gt;
&lt;br /&gt;
function suite:assertLinkIsSuppressed(s)&lt;br /&gt;
	self:assertStringContains(linkPattern, s)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function suite:assertLinkIsNotSuppressed(s)&lt;br /&gt;
	self:assertNotStringContains(linkPattern, s)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: when no icon code is specified, a file link is output&amp;quot;] = function(self)&lt;br /&gt;
	self:assertIsFileLink(icon{})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: when an existing icon code is specified, a file link is output&amp;quot;] = function(self)&lt;br /&gt;
	self:assertIsFileLink(icon{&amp;#039;fa&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: when an nonexistent icon code is specified, a file link is output&amp;quot;] = function(self)&lt;br /&gt;
	self:assertIsFileLink(icon{&amp;#039;nonexistentcode&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: when an existing code is specified, the relevant image is displayed&amp;quot;] = function(self)&lt;br /&gt;
	self:assertStringContains(&amp;#039;Symbol support vote.svg&amp;#039;, icon{&amp;#039;ga&amp;#039;}, true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: when an existing code is specified, the relevant tooltip is displayed&amp;quot;] = function(self)&lt;br /&gt;
	self:assertStringContains(&amp;#039;Good article&amp;#039;, icon{&amp;#039;ga&amp;#039;}, true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: when no dimensions are specified, the image is output as 16x16 pixels&amp;quot;] = function(self)&lt;br /&gt;
	self:assertStringContains(&amp;#039;16x16px&amp;#039;, icon{})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: when custom dimensions are specified, the image is output with those dimensions&amp;quot;] = function(self)&lt;br /&gt;
	self:assertStringContains(&amp;#039;320px&amp;#039;, icon{size = &amp;#039;320px&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: codes can have surrounding whitespace&amp;quot;] = function(self)&lt;br /&gt;
	self:assertStringContains(&amp;#039;Featured article&amp;#039;, icon{&amp;#039;  fa  &amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: codes can be upper case&amp;quot;] = function(self)&lt;br /&gt;
	self:assertStringContains(&amp;#039;Featured article&amp;#039;, icon{&amp;#039;FA&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: codes can be specified with the &amp;#039;class&amp;#039; parameter&amp;quot;] = function(self)&lt;br /&gt;
	self:assertStringContains(&amp;#039;Featured article&amp;#039;, icon{class = &amp;#039;fa&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: the class parameter has precedence over the first positional parameter&amp;quot;] = function(self)&lt;br /&gt;
	self:assertNotStringContains(&amp;#039;Featured article&amp;#039;, icon{&amp;#039;fa&amp;#039;, class = &amp;#039;ga&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: the class parameter has precedence over the first positional parameter, even if the class parameter is the empty string&amp;quot;] = function(self)&lt;br /&gt;
	self:assertNotStringContains(&amp;#039;Featured article&amp;#039;, icon{&amp;#039;fa&amp;#039;, class = &amp;#039;&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: links are suppressed when the entry in the data table has &amp;#039;link&amp;#039; set to false&amp;quot;] = function(self)&lt;br /&gt;
	self:assertLinkIsSuppressed(icon{&amp;#039;ga&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: links are not suppressed when the entry in the data table has &amp;#039;link&amp;#039; set to true&amp;quot;] = function(self)&lt;br /&gt;
	self:assertNotStringContains(linkPattern, icon{&amp;#039;fa&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test _main: links are not suppressed when the entry in the data table has no value for &amp;#039;link&amp;#039;&amp;quot;] = function(self)	&lt;br /&gt;
	self:assertNotStringContains(linkPattern, icon{&amp;#039;stiles.casa_wiki&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
suite[&amp;quot;test Module:Icon/data: codes can be specified as aliases&amp;quot;] = function(self)	&lt;br /&gt;
	self:assertStringContains(&amp;#039;Former featured article&amp;#039;, mIcon._main{&amp;#039;dfa&amp;#039;})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return suite&lt;/div&gt;</summary>
		<author><name>imported&gt;Mr. Stradivarius</name></author>
	</entry>
</feed>