aboutsummaryrefslogtreecommitdiff
path: root/t/pagespec_match.t
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-11-09 15:31:57 -0500
committerJoey Hess <joey@kodama.kitenet.net>2008-11-09 15:31:57 -0500
commit7f80e52543891690e3136855bc29917e6b431aba (patch)
tree6c041065f96d607803f9d1f4a17f12cfa61e5312 /t/pagespec_match.t
parentd552b2843020283b019729caf588f2e60b3a5396 (diff)
downloadikiwiki-7f80e52543891690e3136855bc29917e6b431aba.tar
ikiwiki-7f80e52543891690e3136855bc29917e6b431aba.tar.gz
Fix the link() pagespec to match links that are internally recorded as absolute.
This fixes a problem exposed by the recent change to tags (a2839de9362187b67b0e3a564461e272e64fd9b4). That recorded tag links as absolute by including a leading slash in the link. The same could also be done with an absolute wikilink. In either case, link() would not match such links, unless the leading slash was included in the link to match. But that's not right, because pagespecs match absolute by default. So strip the leading slash. Note that to keep any existing `link(/foo)` pagespecs working after this change, the leading slash is removed from there, too.
Diffstat (limited to 't/pagespec_match.t')
-rwxr-xr-xt/pagespec_match.t5
1 files changed, 4 insertions, 1 deletions
diff --git a/t/pagespec_match.t b/t/pagespec_match.t
index c61d16122..7c0ac235b 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 => 56;
+use Test::More tests => 58;
BEGIN { use_ok("IkiWiki"); }
@@ -40,6 +40,7 @@ $links{"bugs/bar"}=[qw{done}];
$links{"done"}=[];
$links{"examples/softwaresite/bugs/fails_to_frobnicate"}=[qw{done}];
$links{"examples/softwaresite/bugs/done"}=[];
+$links{"ook"}=[qw{/blog/tags/foo}];
ok(pagespec_match("foo", "link(bar)"), "link");
ok(pagespec_match("foo", "link(ba?)"), "glob link");
@@ -55,6 +56,8 @@ ok(pagespec_match("bar", "backlink(foo)"), "backlink");
ok(! pagespec_match("quux", "backlink(foo)"), "failed backlink");
ok(! pagespec_match("bar", ""), "empty pagespec should match nothing");
ok(! pagespec_match("bar", " "), "blank pagespec should match nothing");
+ok(pagespec_match("ook", "link(blog/tags/foo)"), "link internal absolute success");
+ok(pagespec_match("ook", "link(/blog/tags/foo)"), "link explicit absolute success");
$IkiWiki::pagectime{foo}=1154532692; # Wed Aug 2 11:26 EDT 2006
$IkiWiki::pagectime{bar}=1154532695; # after