summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-04-26 18:47:17 -0400
committerJoey Hess <joey@kitenet.net>2010-04-26 18:47:17 -0400
commit3ac2ae1f14952bd92038183d92b1eb618c9d0f55 (patch)
treec07aa8d1dfde0049f9ae414db8fdab54266328b0 /t
parent194824ce293a64f7dce68d568d1f906d675af858 (diff)
Add page() PageSpec, which is like glob() but matches only pages, not other files.
Diffstat (limited to 't')
-rwxr-xr-xt/pagespec_match.t16
1 files changed, 15 insertions, 1 deletions
diff --git a/t/pagespec_match.t b/t/pagespec_match.t
index ade9bca5a..97bcc969c 100755
--- a/t/pagespec_match.t
+++ b/t/pagespec_match.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 75;
+use Test::More tests => 85;
BEGIN { use_ok("IkiWiki"); }
@@ -66,7 +66,21 @@ $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(ba?)"), "glob link");
ok(! pagespec_match("foo", "link(quux)"), "failed link");