Module:Official website/testcases: Difference between revisions
Appearance
Content deleted Content added
test |
test |
||
Line 7: | Line 7: | ||
'example.com', |
'example.com', |
||
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>' |
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>' |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}, |
}, |
||
{ |
{ |
||
Line 26: | Line 30: | ||
{ |
{ |
||
'URL= example.com', |
'URL= example.com', |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>' |
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>' |
||
}, |
}, |
||
Line 58: | Line 58: | ||
{ |
{ |
||
'http://example.com | Example', |
'http://example.com | Example', |
||
'<span class="official-website"><span class="url">[http://example.com Example |
'<span class="official-website"><span class="url">[http://example.com Example]</span></span>' |
||
}, |
}, |
||
{ |
{ |
||
'url= http://example.com |name= Example', |
'url= http://example.com |name= Example', |
||
'<span class="official-website"><span class="url">[http://example.com Example |
'<span class="official-website"><span class="url">[http://example.com Example]</span></span>' |
||
}, |
}, |
||
{ |
{ |
||
Line 80: | Line 80: | ||
'example.com', |
'example.com', |
||
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>' |
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>' |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
}, |
}, |
||
{ |
{ |
||
Line 99: | Line 103: | ||
{ |
{ |
||
'URL= example.com', |
'URL= example.com', |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>' |
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>' |
||
}, |
}, |
||
Line 131: | Line 131: | ||
{ |
{ |
||
'http://example.com | Example', |
'http://example.com | Example', |
||
'<span class="official-website"><span class="url">[http://example.com Example |
'<span class="official-website"><span class="url">[http://example.com Example]</span></span>' |
||
}, |
}, |
||
{ |
{ |
||
'url= http://example.com |name= Example', |
'url= http://example.com |name= Example', |
||
'<span class="official-website"><span class="url">[http://example.com Example |
'<span class="official-website"><span class="url">[http://example.com Example]</span></span>' |
||
}, |
}, |
||
{ |
{ |
Revision as of 20:11, 4 August 2018
![]() | This is the test cases page for the module Module:Official website. Results of the test cases. |
local p = require('Module:UnitTests')
function p:test_module()
self:preprocess_equals_many('{{#invoke:Official website|main | ', ' }}', {
{
'example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'//example.com',
'<span class="official-website"><span class="url">[//example.com Official website]</span></span>'
},
{
'',
'<strong class="error">No URL found. Please specify a URL here or add one to Wikidata.</strong>'
},
{
'www.example.com/path?section=96',
'<strong class="error">No URL found. Please specify a URL here or add one to Wikidata.</strong>'
},
{
'1= www.example.com/path?section=96',
'<span class="official-website"><span class="url">[http://www.example.com/path?section=96 Official website]</span></span>'
},
{
'url= example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'URL= example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'http:/example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'http://example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'http://example.com/',
'<span class="official-website"><span class="url">[http://example.com/ Official website]</span></span>'
},
{
'http://www.example.com:80',
'<span class="official-website"><span class="url">[http://www.example.com:80 Official website]</span></span>'
},
{
'https://example.com',
'<span class="official-website"><span class="url">[https://example.com Official website]</span></span>'
},
{
'ftp://example.com',
'<span class="official-website"><span class="url">[ftp://example.com Official website]</span></span>'
},
{
'http://example.com | Example',
'<span class="official-website"><span class="url">[http://example.com Example]</span></span>'
},
{
'url= http://example.com |name= Example',
'<span class="official-website"><span class="url">[http://example.com Example]</span></span>'
},
{
'http://example.com |format= flash',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span> <span style="font-size:0.95em; font-size:90%; color:#555">(Requires [[Adobe Flash Player]])</span>'
},
{
'http://example.com |mobile= http://m.example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span> (<span class="url">[http://m.example.com Mobile]</span>)'
},
} )
end
function p:test_sandbox()
self:preprocess_equals_many('{{#invoke:Official website/sandbox|main | ', ' }}', {
{
'example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'//example.com',
'<span class="official-website"><span class="url">[//example.com Official website]</span></span>'
},
{
'',
'<strong class="error">No URL found. Please specify a URL here or add one to Wikidata.</strong>'
},
{
'www.example.com/path?section=96',
'<strong class="error">No URL found. Please specify a URL here or add one to Wikidata.</strong>'
},
{
'1= www.example.com/path?section=96',
'<span class="official-website"><span class="url">[http://www.example.com/path?section=96 Official website]</span></span>'
},
{
'url= example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'URL= example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'http:/example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'http://example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span>'
},
{
'http://example.com/',
'<span class="official-website"><span class="url">[http://example.com/ Official website]</span></span>'
},
{
'http://www.example.com:80',
'<span class="official-website"><span class="url">[http://www.example.com:80 Official website]</span></span>'
},
{
'https://example.com',
'<span class="official-website"><span class="url">[https://example.com Official website]</span></span>'
},
{
'ftp://example.com',
'<span class="official-website"><span class="url">[ftp://example.com Official website]</span></span>'
},
{
'http://example.com | Example',
'<span class="official-website"><span class="url">[http://example.com Example]</span></span>'
},
{
'url= http://example.com |name= Example',
'<span class="official-website"><span class="url">[http://example.com Example]</span></span>'
},
{
'http://example.com |format= flash',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span> <span style="font-size:0.95em; font-size:90%; color:#555">(Requires [[Adobe Flash Player]])</span>'
},
{
'http://example.com |mobile= http://m.example.com',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span> (<span class="url">[http://m.example.com Mobile]</span>)'
},
{
'http://example.jp | lang= jp',
'<span class="official-website"><span class="url">[http://example.jp Official website]</span></span> <span class="languageicon">(in Japanese)</span>'
},
{
'http://example.com | lang= en',
'<span class="official-website"><span class="url">[http://example.com Official website]</span></span> <span class="languageicon">(in English)</span>'
},
} )
end
return p