Modul:URL/testtilfeller
Utseende
![]() | Denne siden inneholder testtilfeller for modulen Modul:URL. Vis resultater fra testene. |
-- Unit tests for [[Module:URL]]. Click talk page to run tests.
local p = require('Module:UnitTests')
function p:test_url()
self:preprocess_equals_many('{{#invoke:URL|url|', '}}', {
{'', '{{URL|example.com|optional display text}}'},
{' EXAMPLE.com ', 'example.com'},
{' example.com ', 'example.com'},
{' www.example.com ', 'www.example.com'},
{' http://www.example.com ', 'www.example.com'},
{' https://www.example.com ', 'www.example.com'},
{' ftp://www.example.com ', 'www.example.com'},
{' ftp://ftp.example.com ', 'ftp.example.com'},
{' http://www.example.com/ ', 'www.example.com'},
{' http://www.example.com/path ', 'www.example.com/path'},
{' www.example.com/foo ', 'www.example.com/foo'},
{' http://www.example.com/foo | link ', 'link'},
{' www.example.com/foo | link ', 'link'},
{' http://www.example.com/path/ ', 'www.example.com/path/'},
{' www.example.com/foo/ ', 'www.example.com/foo/'},
{' 1=http://www.example.com/path?section=17 ', 'www.example.com/path?section=17'},
{' 1=www.example.com/foo?page=42 ', 'www.example.com/foo?page=42'},
{' http://www.example.com/foo/ | link ', 'link'},
{' www.example.com/foo/ | link ', 'link'},
})
end
return p