Module:Official website/testcases

local p = require('Module:UnitTests')

function p:test_module self:preprocess_equals_many(, {		{		'example.com',		' Official website  '		},		{		'//example.com',		'  [//example.com Official website]  '		},		{		,		' No URL found. Please specify a URL here or add one to Wikidata. '		},		{		'www.example.com/path?section=96',		' No URL found. Please specify a URL here or add one to Wikidata. '		},		{		'1= www.example.com/path?section=96',		'  Official website  '		},		{		'url= example.com',		'  Official website  '		},		{		'URL= example.com',		'  Official website  '		},		{		'http:/example.com',		'  Official website  '		},		{		'http://example.com',		'  Official website  '		},		{		'http://example.com/',		'  Official website  '		},		{		'http://www.example.com:80',		'  Official website  ' },		{		'https://example.com', ' Official website  ' },		{		'ftp://example.com', ' Official website  ' },		{		'http://example.com | Example', ' Example  ' },		{		'url= http://example.com |name= Example', ' Example  ' },		{		'http://example.com |format= flash', ' Official website  (Requires Adobe Flash Player) ' },		{		'http://example.com |mobile= http://m.example.com', ' Official website  ( Mobile )' },		{		'https://example.com |format= flash |mobile= https://m.example.com', ' Official website  (Requires Adobe Flash Player) ( Mobile )' },	} ) end

function p:test_module_nowiki self:preprocess_equals_many(, {		{		'example.com',		' Official website  '		},		{		'//example.com',		'  [//example.com Official website]  '		},		{		,		' No URL found. Please specify a URL here or add one to Wikidata. '		},		{		'www.example.com/path?section=96',		' No URL found. Please specify a URL here or add one to Wikidata. '		},		{		'1= www.example.com/path?section=96',		'  Official website  '		},		{		'url= example.com',		'  Official website  '		},		{		'URL= example.com',		'  Official website  '		},		{		'http:/example.com',		'  Official website  '		},		{		'http://example.com',		'  Official website  '		},		{		'http://example.com/',		'  Official website  '		},		{		'http://www.example.com:80',		'  Official website  ' },		{		'https://example.com', ' Official website  ' },		{		'ftp://example.com', ' Official website  ' },		{		'http://example.com | Example', ' Example  ' },		{		'url= http://example.com |name= Example', ' Example  ' },		{		'http://example.com |format= flash', ' Official website  (Requires Adobe Flash Player) ' },		{		'http://example.com |mobile= http://m.example.com', ' Official website  ( Mobile )' },		{		'https://example.com |format= flash |mobile= https://m.example.com', ' Official website  (Requires Adobe Flash Player) ( Mobile )' },	},{nowiki=1}) end

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

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

return p