Module:Official website/testcases

local p = require('Module:UnitTests')

function p:test_module self:preprocess_equals_many(, {		{		'example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		'//example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;[//example.com Official website]&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		,		'&#x3c;strong class="error"&#x3e;No URL found. Please specify a URL here or add one to Wikidata.&#x3c;/strong&#x3e;'		},		{		'www.example.com/path?section=96',		'&#x3c;strong class="error"&#x3e;No URL found. Please specify a URL here or add one to Wikidata.&#x3c;/strong&#x3e;'		},		{		'1= www.example.com/path?section=96',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		'url= example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'URL= example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http:/example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com/', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://www.example.com:80', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'https://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'ftp://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com | Example', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Example&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'url= http://example.com |name= Example', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Example&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com |format= flash', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e;' },		{		'http://example.com |mobile= http://m.example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;)' },		{		'https://example.com |format= flash |mobile= https://m.example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;)' },	} ) end

function p:test_module_nowiki self:preprocess_equals_many(, {		{		'example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		'//example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;[//example.com Official website]&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		,		'&#x3c;strong class="error"&#x3e;No URL found. Please specify a URL here or add one to Wikidata.&#x3c;/strong&#x3e;'		},		{		'www.example.com/path?section=96',		'&#x3c;strong class="error"&#x3e;No URL found. Please specify a URL here or add one to Wikidata.&#x3c;/strong&#x3e;'		},		{		'1= www.example.com/path?section=96',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		'url= example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'URL= example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http:/example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com/', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://www.example.com:80', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'https://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'ftp://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com | Example', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Example&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'url= http://example.com |name= Example', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Example&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com |format= flash', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e;' },		{		'http://example.com |mobile= http://m.example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;)' },		{		'https://example.com |format= flash |mobile= https://m.example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;)' },	},{nowiki=1}) end

function p:test_sandbox self:preprocess_equals_many(, {		{		'example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		'//example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;[//example.com Official website]&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		,		'&#x3c;strong class="error"&#x3e;No URL found. Please specify a URL here or add one to Wikidata.&#x3c;/strong&#x3e;'		},		{		'www.example.com/path?section=96',		'&#x3c;strong class="error"&#x3e;No URL found. Please specify a URL here or add one to Wikidata.&#x3c;/strong&#x3e;'		},		{		'1= www.example.com/path?section=96',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		'url= example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'URL= example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http:/example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com/', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://www.example.com:80', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'https://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'ftp://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com | Example', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Example&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'url= http://example.com |name= Example', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Example&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com |format= flash', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e;' },		{		'http://example.com |mobile= http://m.example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;)' },		{		'https://example.com |format= flash |mobile= https://m.example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;)' },		{		'http://example.jp | lang= jp', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span class="languageicon"&#x3e;(in Japanese)&#x3c;/span&#x3e;' },		{		'http://example.com | lang= en', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span class="languageicon"&#x3e;(in English)&#x3c;/span&#x3e;' },		{		'https://example.com |format= flash |mobile= https://m.example.com | lang= es', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;) &#x3c;span class="languageicon"&#x3e;(in Spanish)&#x3c;/span&#x3e;' },	} ) end

function p:test_sandbox_nowiki self:preprocess_equals_many(, {		{		'example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		'//example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;[//example.com Official website]&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		,		'&#x3c;strong class="error"&#x3e;No URL found. Please specify a URL here or add one to Wikidata.&#x3c;/strong&#x3e;'		},		{		'www.example.com/path?section=96',		'&#x3c;strong class="error"&#x3e;No URL found. Please specify a URL here or add one to Wikidata.&#x3c;/strong&#x3e;'		},		{		'1= www.example.com/path?section=96',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;'		},		{		'url= example.com',		'&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'URL= example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http:/example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com/', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://www.example.com:80', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'https://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'ftp://example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com | Example', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Example&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'url= http://example.com |name= Example', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Example&#x3c;/span&#x3e;&#x3c;/span&#x3e;' },		{		'http://example.com |format= flash', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e;' },		{		'http://example.com |mobile= http://m.example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;)' },		{		'https://example.com |format= flash |mobile= https://m.example.com', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;)' },		{		'http://example.jp | lang= jp', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span class="languageicon"&#x3e;(in Japanese)&#x3c;/span&#x3e;' },		{		'http://example.com | lang= en', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span class="languageicon"&#x3e;(in English)&#x3c;/span&#x3e;' },		{		'https://example.com |format= flash |mobile= https://m.example.com | lang= es', '&#x3c;span class="official-website"&#x3e;&#x3c;span class="url"&#x3e;Official website&#x3c;/span&#x3e;&#x3c;/span&#x3e; &#x3c;span style="color:#505050"&#x3e;(Requires Adobe Flash Player)&#x3c;/span&#x3e; (&#x3c;span class="url"&#x3e;Mobile&#x3c;/span&#x3e;) &#x3c;span class="languageicon"&#x3e;(in Spanish)&#x3c;/span&#x3e;' },	},{nowiki=1}) end

return p