]> sipb.mit.edu Git - ikiwiki.git/blobdiff - t/linkify.t
updates for usedirs
[ikiwiki.git] / t / linkify.t
index bc7c0e4a8c6810ac8cc87cf97846c81c14c77110..c7bfbcd382c30c5e15cddd725efc94e3553e3ec1 100755 (executable)
@@ -1,10 +1,13 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 14;
+use Test::More tests => 16;
 
 BEGIN { use_ok("IkiWiki"); }
 
+# currently coded for non usedirs mode (TODO: check both)
+$config{usedirs}=0;
+
 sub linkify ($$$$) {
        my $lpage=shift;
        my $page=shift;
@@ -20,6 +23,7 @@ sub linkify ($$$$) {
                $IkiWiki::pagecase{lc $page}=$page;
                $links{$page}=[];
                $renderedfiles{"$page.mdwn"}=[$page];
+               $destsources{$page}="$page.mdwn";
        }
        %config=IkiWiki::defaultconfig();
        $config{cgiurl}="http://somehost/ikiwiki.cgi";
@@ -68,6 +72,7 @@ sub links_text ($$) {
 
 
 ok(links_to("bar", linkify("foo", "foo", "link to [[bar]] ok", ["foo", "bar"])), "ok link");
+ok(links_to("bar_baz", linkify("foo", "foo", "link to [[bar_baz]] ok", ["foo", "bar_baz"])), "ok link");
 ok(not_links_to("bar", linkify("foo", "foo", "link to \\[[bar]] ok", ["foo", "bar"])), "escaped link");
 ok(links_to("page=bar", linkify("foo", "foo", "link to [[bar]] ok", ["foo"])), "broken link");
 ok(links_to("bar", linkify("foo", "foo", "link to [[baz]] and [[bar]] ok", ["foo", "baz", "bar"])), "dual links");
@@ -80,4 +85,4 @@ ok(links_text("0", linkify("foo", "foo", "link to [[0|bar]] ok", ["foo", "bar"])
 ok(links_text("Some long, & complex page name.", linkify("foo", "foo", "link to [[Some long, & complex page name.|bar]] ok, and this is not a link]] here", ["foo", "bar"])), "complex named link text");
 ok(links_to("foo/bar", linkify("foo/item", "foo", "link to [[bar]] ok", ["foo", "foo/item", "foo/bar"])), "inline page link");
 ok(links_to("bar", linkify("foo", "foo", "link to [[bar]] ok", ["foo", "foo/item", "foo/bar"])), "same except not inline");
-
+ok(links_to("bar#baz", linkify("foo", "foo", "link to [[bar#baz]] ok", ["foo", "bar"])), "anchor link");