X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/70bdd57899294fffd30077b7518ba23710c9d55b..9dce803faf4dac9ee9249a108e9054e296e1f741:/t/urlto.t diff --git a/t/urlto.t b/t/urlto.t index a0b3baa45..338632e94 100755 --- a/t/urlto.t +++ b/t/urlto.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 19; +use Test::More tests => 26; BEGIN { use_ok("IkiWiki"); } @@ -19,17 +19,23 @@ 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/"); +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"); is(IkiWiki::cgiurl(do => 'badger'), "/cgi-bin/ikiwiki.cgi?do=badger"); is(IkiWiki::baseurl(undef), "/"); 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"); @@ -42,3 +48,4 @@ 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/"); +is(IkiWiki::urlto('', undef), "http://example.co.uk/~smcv/");