<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.therofl98.co/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AQuickTest</id>
	<title>Module:QuickTest - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.therofl98.co/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AQuickTest"/>
	<link rel="alternate" type="text/html" href="https://wiki.therofl98.co/w/index.php?title=Module:QuickTest&amp;action=history"/>
	<updated>2026-06-04T10:02:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.therofl98.co/w/index.php?title=Module:QuickTest&amp;diff=2864&amp;oldid=prev</id>
		<title>FairPlay137: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.therofl98.co/w/index.php?title=Module:QuickTest&amp;diff=2864&amp;oldid=prev"/>
		<updated>2019-03-06T03:14:49Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 22:14, 5 March 2019&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key enttscwiki:diff:1.41:old-2863:rev-2864 --&gt;
&lt;/table&gt;</summary>
		<author><name>FairPlay137</name></author>
	</entry>
	<entry>
		<id>https://wiki.therofl98.co/w/index.php?title=Module:QuickTest&amp;diff=2863&amp;oldid=prev</id>
		<title>commons&gt;Rillke: Display correct test command</title>
		<link rel="alternate" type="text/html" href="https://wiki.therofl98.co/w/index.php?title=Module:QuickTest&amp;diff=2863&amp;oldid=prev"/>
		<updated>2016-04-01T23:05:06Z</updated>

		<summary type="html">&lt;p&gt;Display correct test command&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Tests whether a module has a test API, and if so, runs these tests&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
function p.run(titleCurrentPage)&lt;br /&gt;
	local title = titleCurrentPage&lt;br /&gt;
	local titlesplit = mw.text.split(title, &amp;#039;/&amp;#039;, true)&lt;br /&gt;
	if titlesplit[1]:find(&amp;#039;Module:&amp;#039;, 1, true) ~= 1 then return &amp;#039;&amp;#039; end&lt;br /&gt;
	if titlesplit[#titlesplit] == &amp;#039;doc&amp;#039; then&lt;br /&gt;
		table.remove(titlesplit)&lt;br /&gt;
	end&lt;br /&gt;
	title = table.concat(titlesplit, &amp;#039;/&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	-- Load the module&lt;br /&gt;
	local m = require(title)&lt;br /&gt;
	local testType = &amp;#039;public-member&amp;#039;&lt;br /&gt;
	local testFunction = ( (type(m) == &amp;#039;table&amp;#039;) and (getmetatable(m) and getmetatable(m).quickTests or m[&amp;#039;runTests&amp;#039;]) )&lt;br /&gt;
	local testFunctionType = type(testFunction)&lt;br /&gt;
	if ( (type(m) == &amp;#039;table&amp;#039;) and (getmetatable(m) and getmetatable(m).quickTests) ) then&lt;br /&gt;
		testType = &amp;#039;meta-table&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	if ( testFunctionType ~= &amp;#039;function&amp;#039; and not ( testFunctionType == &amp;#039;table&amp;#039; and getmetatable(testFunction).__call ) ) then&lt;br /&gt;
		return &amp;#039;&amp;#039;, title, testType&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Execute the test function&lt;br /&gt;
	local ok, result = pcall(testFunction)&lt;br /&gt;
	if ok then&lt;br /&gt;
		return result, title, testType&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;#039;error&amp;#039;, title, testType&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function cat(title, titleCurrentPage, cat)&lt;br /&gt;
	if titleCurrentPage == title then return cat end&lt;br /&gt;
	return &amp;#039;&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.testModule(frame)&lt;br /&gt;
	local titleCurrentPage =  ( frame.args and frame.args.title ) or ( frame and frame:preprocess(&amp;#039;{{FULLPAGENAME}}&amp;#039;) ) or &amp;#039;Frame not defined.&amp;#039;&lt;br /&gt;
	local testResult, title, testType = p.run(titleCurrentPage)&lt;br /&gt;
	local testCode = &amp;#039;=p.runTests()&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	if testResult == true then&lt;br /&gt;
		return &amp;#039;[[File:Octicons-check.svg|16px|alt=Quick tests passed|Quick tests passed|link=COM:LUA/T#auto]]&amp;#039; .. cat(title, titleCurrentPage, &amp;#039;[[Category:Scribunto modules with tests passed]]&amp;#039;)&lt;br /&gt;
	elseif testResult == false then&lt;br /&gt;
		if testType == &amp;#039;meta-table&amp;#039; then&lt;br /&gt;
			testCode = &amp;#039;=getmetatable(p).quickTests()&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		return &amp;#039;[[File:Octicons-bug.svg|16px|alt=Bug executing tests|Bug executing tests|link=COM:LUA/T#auto]] Run &amp;lt;code&amp;gt;&amp;#039; .. testCode .. &amp;#039;&amp;lt;/code&amp;gt; in the LUA console on [[&amp;#039; .. title .. &amp;#039;]] for more details.&amp;#039; .. cat(title, titleCurrentPage, &amp;#039;[[Category:Scribunto modules with tests failed]]&amp;#039;)&lt;br /&gt;
	elseif testResult == &amp;#039;error&amp;#039; then&lt;br /&gt;
		return &amp;#039;[[File:Octicons-issue-opened.svg|16px|alt=Error|link=COM:LUA/T#auto]] Error executing tests.&amp;#039; .. cat(title, titleCurrentPage, &amp;#039;[[Category:Scribunto modules with errors executing tests]]&amp;#039;)&lt;br /&gt;
	else&lt;br /&gt;
		return &amp;#039;[[File:Octicons-megaphone.svg|16px|alt=No test API|link=COM:LUA/T#auto-howto]] &amp;#039;.. testResult .. cat(title, titleCurrentPage, &amp;#039;[[Category:Scribunto modules without test API]]&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.injectResult(frame)&lt;br /&gt;
	local result = p.testModule(frame)&lt;br /&gt;
	if result == &amp;#039;&amp;#039; then return &amp;#039;&amp;#039; end&lt;br /&gt;
	&lt;br /&gt;
	return ( frame.args[&amp;#039;pattern&amp;#039;]:gsub(&amp;#039;%%result%%&amp;#039;, result) )&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local mt = {&lt;br /&gt;
	quickTests = function ()&lt;br /&gt;
		return &amp;#039;function&amp;#039; == type( p.injectResult )&lt;br /&gt;
	end&lt;br /&gt;
}&lt;br /&gt;
setmetatable(p, mt)&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>commons&gt;Rillke</name></author>
	</entry>
</feed>