4 use Test::More tests => 9;
6 BEGIN { use_ok("IkiWiki"); }
11 my @existing_pages=@{shift()};
13 %IkiWiki::pagecase=();
15 foreach my $page (@existing_pages) {
16 $IkiWiki::pagecase{lc $page}=$page;
20 return bestlink($page, $link);
23 is(test("bar", "foo", ["bar"]), "", "broken link");
24 is(test("bar", "foo", ["bar", "foo"]), "foo", "simple link");
25 is(test("bar", "FoO", ["bar", "foo"]), "foo", "simple link with different input case");
26 is(test("bar", "foo", ["bar", "fOo"]), "fOo", "simple link with different page case");
27 is(test("bar", "FoO", ["bar", "fOo"]), "fOo", "simple link with different page and input case");
28 is(test("bar", "Foo", ["bar", "fOo", "foo", "fOO", "Foo", "fOo"]), "Foo", "in case of ambiguity, like case wins");
29 is(test("bar", "foo", ["bar", "foo", "bar/foo"]), "bar/foo", "simple subpage link");
30 is(test("bar", "foo/subpage", ["bar", "foo", "bar/subpage", "foo/subpage"]), "foo/subpage", "cross subpage link");