diff options
author | Simon McVittie <smcv@debian.org> | 2010-12-25 22:11:33 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2010-12-25 22:54:54 +0000 |
commit | 524a78eaca2bb7bbf06b96797f3e9a4fd6efa4de (patch) | |
tree | 8b46d4fdd5d066ac9e027dbbef0b6eeb2047fa14 /t | |
parent | 44cc8ca42072a865857ab7f7a8706a7a4d4a1e49 (diff) |
urlto.t: test more cases, including the special case for to=''
Diffstat (limited to 't')
-rwxr-xr-x | t/urlto.t | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 21; +use Test::More tests => 24; BEGIN { use_ok("IkiWiki"); } @@ -19,6 +19,8 @@ is(IkiWiki::cgiurl(cgiurl => $config{cgiurl}), "http://smcv.example.co.uk/cgi-bi is(IkiWiki::cgiurl(cgiurl => $config{cgiurl}, do => 'badger'), "http://smcv.example.co.uk/cgi-bin/ikiwiki.cgi?do=badger"); is(IkiWiki::urlto('index', undef, 1), "http://smcv.example.co.uk/"); is(IkiWiki::urlto('stoats', undef, 1), "http://smcv.example.co.uk/stoats/"); +# FIXME: this actually produces / not the desired absolute URL +#is(IkiWiki::urlto('', undef, 1), "http://smcv.example.co.uk/"); # "local" (absolute path within site) version (default for cgiurl) is(IkiWiki::cgiurl(), "/cgi-bin/ikiwiki.cgi"); @@ -28,10 +30,13 @@ is(IkiWiki::urlto('index', undef), "/"); is(IkiWiki::urlto('index'), "/"); is(IkiWiki::urlto('stoats', undef), "/stoats/"); is(IkiWiki::urlto('stoats'), "/stoats/"); +is(IkiWiki::urlto(''), "/"); # fully-relative version (default for urlto and baseurl) is(IkiWiki::baseurl('badger/mushroom'), "../../"); is(IkiWiki::urlto('badger/mushroom', 'snake'), "../badger/mushroom/"); +is(IkiWiki::urlto('', 'snake'), "../"); +is(IkiWiki::urlto('', 'penguin/herring'), "../../"); # explicit cgiurl override is(IkiWiki::cgiurl(cgiurl => 'https://foo/ikiwiki'), "https://foo/ikiwiki"); @@ -44,3 +49,5 @@ is(IkiWiki::checkconfig(), 1); is(IkiWiki::cgiurl(), "http://dynamic.example.co.uk/~smcv/ikiwiki.cgi"); is(IkiWiki::baseurl(undef), "http://example.co.uk/~smcv/"); is(IkiWiki::urlto('stoats', undef), "http://example.co.uk/~smcv/stoats/"); +# FIXME: this actually produces ./http://example.co.uk/~smcv/ +#is(IkiWiki::urlto('', undef), "http://example.co.uk/~smcv/"); |