X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/fcf3894e807958a40cd50aa350dbec21fb7410e2..758a4c23fd0fc30b89739f0d2be7bf0fe2f81be8:/t/bestlink.t?ds=inline diff --git a/t/bestlink.t b/t/bestlink.t index ece900152..0020a05e2 100755 --- a/t/bestlink.t +++ b/t/bestlink.t @@ -1,7 +1,9 @@ #!/usr/bin/perl use warnings; use strict; -use Test::More tests => 9; +use Test::More tests => 11; + +BEGIN { use_ok("IkiWiki"); } sub test ($$$) { my $page=shift; @@ -9,17 +11,16 @@ sub test ($$$) { my @existing_pages=@{shift()}; %IkiWiki::pagecase=(); - %IkiWiki::links=(); + %pagesources=(); + $IkiWiki::config{userdir}="foouserdir"; foreach my $page (@existing_pages) { $IkiWiki::pagecase{lc $page}=$page; - $IkiWiki::links{$page}=[]; + $pagesources{$page}="$page.mdwn"; } - return IkiWiki::bestlink($page, $link); + return bestlink($page, $link); } -BEGIN { use_ok("IkiWiki"); } - is(test("bar", "foo", ["bar"]), "", "broken link"); is(test("bar", "foo", ["bar", "foo"]), "foo", "simple link"); is(test("bar", "FoO", ["bar", "foo"]), "foo", "simple link with different input case"); @@ -28,3 +29,5 @@ is(test("bar", "FoO", ["bar", "fOo"]), "fOo", "simple link with different page a is(test("bar", "Foo", ["bar", "fOo", "foo", "fOO", "Foo", "fOo"]), "Foo", "in case of ambiguity, like case wins"); is(test("bar", "foo", ["bar", "foo", "bar/foo"]), "bar/foo", "simple subpage link"); is(test("bar", "foo/subpage", ["bar", "foo", "bar/subpage", "foo/subpage"]), "foo/subpage", "cross subpage link"); +is(test("bar", "bob", ["bar", "foo", "foouserdir/bob"]), "foouserdir/bob", "user link"); +is(test("bar", "bob", ["bar", "foo", "bob", "foouserdir/bob"]), "bob", "non-user link");