]> sipb.mit.edu Git - ikiwiki.git/blobdiff - t/pagespec_match.t
YAML is YAML
[ikiwiki.git] / t / pagespec_match.t
index ade9bca5ac113b6a29f7b5c9ef458f61823729d3..fe9624370625a74a57146f8f7de80c56c6215a0b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 75;
+use Test::More tests => 87;
 
 BEGIN { use_ok("IkiWiki"); }
 
@@ -66,8 +66,24 @@ $links{"ook"}=[qw{/blog/tags/foo}];
 foreach my $p (keys %links) {
        $pagesources{$p}="$p.mdwn";
 }
+$pagesources{"foo.png"}="foo.png";
+$pagesources{"foo"}="foo.mdwn";
+$IkiWiki::hooks{htmlize}{mdwn}={};
 
+ok(pagespec_match("foo", "foo"), "simple");
+ok(! pagespec_match("foo", "bar"), "simple fail");
+ok(pagespec_match("foo", "foo"), "simple glob");
+ok(pagespec_match("foo", "f*"), "simple glob fail");
+ok(pagespec_match("foo", "page(foo)"), "page()");
+print pagespec_match("foo", "page(foo)")."\n";
+ok(! pagespec_match("foo", "page(bar)"), "page() fail");
+ok(! pagespec_match("foo.png", "page(foo.png)"), "page() fails on non-page");
+ok(! pagespec_match("foo.png", "page(foo*)"), "page() fails on non-page glob");
+ok(pagespec_match("foo", "page(foo)"), "page() glob");
+ok(pagespec_match("foo", "page(f*)"), "page() glob fail");
 ok(pagespec_match("foo", "link(bar)"), "link");
+ok(pagespec_match("foo", "link(.)", location => "bar"), "link with .");
+ok(! pagespec_match("foo", "link(.)"), "link with . but missing location");
 ok(pagespec_match("foo", "link(ba?)"), "glob link");
 ok(! pagespec_match("foo", "link(quux)"), "failed link");
 ok(! pagespec_match("foo", "link(qu*)"), "failed glob link");