<?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%3AItalic_title%2Ftestcases</id>
	<title>Module:Italic title/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%3AItalic_title%2Ftestcases"/>
	<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Italic_title/testcases&amp;action=history"/>
	<updated>2026-04-09T20:42:59Z</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:Italic_title/testcases&amp;diff=137067&amp;oldid=prev</id>
		<title>imported&gt;Gonnym at 10:45, 21 June 2021</title>
		<link rel="alternate" type="text/html" href="https://stockhub.co/index.php?title=Module:Italic_title/testcases&amp;diff=137067&amp;oldid=prev"/>
		<updated>2021-06-21T10:45:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local mItalicTitle = require(&amp;#039;Module:Italic title/sandbox&amp;#039;)&lt;br /&gt;
local ScribuntoUnit = require(&amp;#039;Module:ScribuntoUnit&amp;#039;)&lt;br /&gt;
local Spy = require(&amp;#039;Module:Lua-mock/Spy&amp;#039;)&lt;br /&gt;
local suite = ScribuntoUnit:new()&lt;br /&gt;
&lt;br /&gt;
local function patchCurrentTitle(page, func)&lt;br /&gt;
	local oldGetCurrentTitle = mw.title.getCurrentTitle&lt;br /&gt;
	mw.title.getCurrentTitle = function ()&lt;br /&gt;
		return mw.title.new(page)&lt;br /&gt;
	end&lt;br /&gt;
	func()&lt;br /&gt;
	mw.title.getCurrentTitle = oldGetCurrentTitle&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function patchDisplayTitle(func)&lt;br /&gt;
	local oldGetCurrentFrame = mw.getCurrentFrame&lt;br /&gt;
	local frame = oldGetCurrentFrame()&lt;br /&gt;
	local oldCallParserFunction = frame.callParserFunction&lt;br /&gt;
	local callParserFunctionSpy = Spy(oldCallParserFunction)&lt;br /&gt;
	mw.getCurrentFrame = function ()&lt;br /&gt;
		return frame&lt;br /&gt;
	end&lt;br /&gt;
	frame.callParserFunction = callParserFunctionSpy&lt;br /&gt;
	func(callParserFunctionSpy, frame)&lt;br /&gt;
	frame.callParserFunction = oldCallParserFunction&lt;br /&gt;
	mw.getCurrentFrame = oldGetCurrentFrame&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local displayTitleTestData = {&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Italicize all - single-word titles&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Example&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Example&amp;lt;/i&amp;gt;&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Italicize all - multi-word titles&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Star Wars&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Star Wars&amp;lt;/i&amp;gt;&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Text in parentheses is not italicized&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Example (dab)&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Example&amp;lt;/i&amp;gt; (dab)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Text in final parentheses is not italicized&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Example (not dab) (dab)&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Example (not dab)&amp;lt;/i&amp;gt; (dab)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Text in disambiguation with parentheses is not italicized&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Example (dab (dab))&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Example&amp;lt;/i&amp;gt; (dab (dab))&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: When the entire title is in parentheses, it is all italicized&amp;#039;,&lt;br /&gt;
		page = &amp;quot;(Example page)&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;(Example page)&amp;lt;/i&amp;gt;&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Only specified string argument italicized (string=)&amp;#039;,&lt;br /&gt;
		page = &amp;quot;List of Ally McBeal episodes&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;Ally McBeal&amp;quot;},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;List of &amp;lt;i&amp;gt;Ally McBeal&amp;lt;/i&amp;gt; episodes&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Only specified string argument italicized - in disambiguation (string= and all=)&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Peter (Fringe episode)&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;Fringe&amp;quot;, all = &amp;quot;yes&amp;quot;},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;Peter (&amp;lt;i&amp;gt;Fringe&amp;lt;/i&amp;gt; episode)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Title and dismabiguation italicized (all=)&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Title (dismabiguation)&amp;quot;,&lt;br /&gt;
		args = {all = &amp;quot;yes&amp;quot;},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Title (dismabiguation)&amp;lt;/i&amp;gt;&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: For pages with a namespace prefix, the namespace prefix is not italicized&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Wikipedia:Example&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;Wikipedia:&amp;lt;i&amp;gt;Example&amp;lt;/i&amp;gt;&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Only specified string argument italicized (string=) in title with a comma&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Morceaux de salon, Op. 6 (Rachmaninoff)&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;Morceaux de salon&amp;quot;},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Morceaux de salon&amp;lt;/i&amp;gt;, Op. 6 (Rachmaninoff)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: Only specified string argument italicized (string= and all=) in title with a comma&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Morceaux de salon, Op. 6 (Rachmaninoff)&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;Morceaux de salon&amp;quot;, all = &amp;quot;yes&amp;quot;},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Morceaux de salon&amp;lt;/i&amp;gt;, Op. 6 (Rachmaninoff)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._dabonly,&lt;br /&gt;
		description = &amp;#039;test _dabonly: Italicize disambiguation&amp;#039;,&lt;br /&gt;
		page = &amp;quot;The End (Lost)&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;The End (&amp;lt;i&amp;gt;Lost&amp;lt;/i&amp;gt;)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._dabonly,&lt;br /&gt;
		description = &amp;#039;test _dabonly: Italicize disambiguation with parentheses&amp;#039;,&lt;br /&gt;
		page = &amp;quot;The Ghost Talks (Randall and Hopkirk (Deceased))&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;The Ghost Talks (&amp;lt;i&amp;gt;Randall and Hopkirk (Deceased)&amp;lt;/i&amp;gt;)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._dabonly,&lt;br /&gt;
		description = &amp;#039;test _dabonly: Italicize final parentheses only&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Title (not disambiguation) (disambiguation)&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;Title (not disambiguation) (&amp;lt;i&amp;gt;disambiguation&amp;lt;/i&amp;gt;)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._dabonly,&lt;br /&gt;
		description = &amp;#039;test _dabonly: When the entire title is in parentheses, it is not italicized&amp;#039;,&lt;br /&gt;
		page = &amp;quot;(Example page)&amp;quot;,&lt;br /&gt;
		args = {},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;(Example page)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._dabonly,&lt;br /&gt;
		description = &amp;#039;test _dabonly: Only specified string argument italicized - in disambiguation (string=)&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Hell on Wheels (Hell on Wheels episode)&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;Hell on Wheels&amp;quot;},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;Hell on Wheels (&amp;lt;i&amp;gt;Hell on Wheels&amp;lt;/i&amp;gt; episode)&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		description = &amp;#039;test _main: When noerror is specified as the first positional argument, it is passed to DISPLAYTITLE&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Example&amp;quot;,&lt;br /&gt;
		args = {&amp;quot;noerror&amp;quot;},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;&amp;lt;i&amp;gt;Example&amp;lt;/i&amp;gt;&amp;quot;, &amp;quot;noerror&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		func = mItalicTitle._dabonly,&lt;br /&gt;
		description = &amp;#039;test _dabonly: When noerror is specified as the first positional argument, it is passed to DISPLAYTITLE&amp;#039;,&lt;br /&gt;
		page = &amp;quot;Example (dab)&amp;quot;,&lt;br /&gt;
		args = {&amp;quot;noerror&amp;quot;},&lt;br /&gt;
		expectedDisplayTitleArgs = {&amp;quot;Example (&amp;lt;i&amp;gt;dab&amp;lt;/i&amp;gt;)&amp;quot;, &amp;quot;noerror&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
for _, testData in ipairs(displayTitleTestData) do&lt;br /&gt;
	suite[testData.description] = function (self)&lt;br /&gt;
		patchCurrentTitle(&lt;br /&gt;
			testData.page,&lt;br /&gt;
			function ()&lt;br /&gt;
				patchDisplayTitle(&lt;br /&gt;
					function (callParserFunctionSpy, frame)&lt;br /&gt;
						testData.func(testData.args)&lt;br /&gt;
						callParserFunctionSpy:assertCallMatches{&lt;br /&gt;
							atIndex = 1,&lt;br /&gt;
							arguments = {&lt;br /&gt;
								frame,&lt;br /&gt;
								&amp;#039;DISPLAYTITLE&amp;#039;,&lt;br /&gt;
								unpack(testData.expectedDisplayTitleArgs),&lt;br /&gt;
							}&lt;br /&gt;
						}&lt;br /&gt;
					end&lt;br /&gt;
				)&lt;br /&gt;
			end&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local categoryTestData = {&lt;br /&gt;
	{&lt;br /&gt;
		description = &amp;quot;test _main: Tracking category is added when the string argument does not match the title&amp;quot;,&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		page = &amp;quot;Example&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;foo&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		description = &amp;quot;test _main: Tracking category is added when the string argument does not match the title or dab, and the all argument is specified&amp;quot;,&lt;br /&gt;
		func = mItalicTitle._main,&lt;br /&gt;
		page = &amp;quot;Example (dab)&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;foo&amp;quot;, all = &amp;quot;yes&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		description = &amp;quot;test _dabonly: Tracking category is added when the string argument does not match the disambiguation&amp;quot;,&lt;br /&gt;
		func = mItalicTitle._dabonly,&lt;br /&gt;
		page = &amp;quot;Example (dab)&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;foo&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		description = &amp;quot;test _dabonly: Tracking category is added when the string argument does not match the disambiguation and no disambiguation is present in title&amp;quot;,&lt;br /&gt;
		func = mItalicTitle._dabonly,&lt;br /&gt;
		page = &amp;quot;Example&amp;quot;,&lt;br /&gt;
		args = {string = &amp;quot;foo&amp;quot;},&lt;br /&gt;
	},&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
for _, testData in ipairs(categoryTestData) do&lt;br /&gt;
	suite[testData.description] = function (self)&lt;br /&gt;
		patchCurrentTitle(&lt;br /&gt;
			testData.page,&lt;br /&gt;
			function ()&lt;br /&gt;
				self:assertStringContains(&lt;br /&gt;
					testData.func(testData.args),&lt;br /&gt;
					&amp;quot;[[Category:Pages using italic title with no matching string]]&amp;quot;,&lt;br /&gt;
					true&lt;br /&gt;
				)&lt;br /&gt;
			end&lt;br /&gt;
		)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return suite&lt;/div&gt;</summary>
		<author><name>imported&gt;Gonnym</name></author>
	</entry>
</feed>