aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-10-13 14:46:38 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-10-13 14:46:38 -0400
commit2f5beb59bff17ace9e33743d646a95204a9be5bc (patch)
treee590437f423bd339404019152fdca12069a31ed4 /t
parenta20bc7a3fc6a2f2369022873ef7c2afbd5e49105 (diff)
downloadikiwiki-2f5beb59bff17ace9e33743d646a95204a9be5bc.tar
ikiwiki-2f5beb59bff17ace9e33743d646a95204a9be5bc.tar.gz
tests for influence blocking
Diffstat (limited to 't')
-rwxr-xr-xt/pagespec_match_list.t24
1 files changed, 11 insertions, 13 deletions
diff --git a/t/pagespec_match_list.t b/t/pagespec_match_list.t
index 51145a973..dd5dcc5b0 100755
--- a/t/pagespec_match_list.t
+++ b/t/pagespec_match_list.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 61;
+use Test::More tests => 88;
BEGIN { use_ok("IkiWiki"); }
@@ -86,23 +86,23 @@ foreach my $spec ("bar or (backlink(foo) and !*.png)", "backlink(foo)") {
%IkiWiki::depends=();
}
-TODO: {
- local $TODO = "optimisation not yet written";
-
-# a pagespec that hard fails due to a glob, etc, will not set influences
-# for other terms that normally would.
-foreach my $spec ("nosuchpage and link(bar)", "link(bar) and */Discussion") {
+# Hard fails due to a glob, etc, will block influences of other anded terms.
+foreach my $spec ("nosuchpage and link(bar)", "link(bar) and nosuchpage",
+ "link(bar) and */Discussion", "*/Discussion and link(bar)",
+ "!foo2 and link(bar)", "link(bar) and !foo2") {
pagespec_match_list("foo2", $spec, deptype => deptype("presence"));
ok($IkiWiki::depends{foo2}{$spec} & $IkiWiki::DEPEND_PRESENCE);
ok(! ($IkiWiki::depends{foo2}{$spec} & ($IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_LINKS)));
- ok(! exists $IkiWiki::depends_simple{foo2}{foo2});
+ ok(! exists $IkiWiki::depends_simple{foo2}{foo2}, "no influence from $spec");
%IkiWiki::depends_simple=();
%IkiWiki::depends=();
}
-# a pagespec containing a hard failure that is ored with another term will
-# get influences from the other term
-foreach my $spec ("nosuchpage or link(bar)", "link(bar) or */Discussion") {
+# A hard fail will not block influences of other ored terms.
+foreach my $spec ("nosuchpage or link(bar)", "link(bar) or nosuchpage",
+ "link(bar) or */Discussion", "*/Discussion or link(bar)",
+ "!foo2 or link(bar)", "link(bar) or !foo2",
+ "link(bar) or (!foo2 and !foo1)") {
pagespec_match_list("foo2", $spec, deptype => deptype("presence"));
ok($IkiWiki::depends{foo2}{$spec} & $IkiWiki::DEPEND_PRESENCE);
ok(! ($IkiWiki::depends{foo2}{$spec} & ($IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_LINKS)));
@@ -110,5 +110,3 @@ foreach my $spec ("nosuchpage or link(bar)", "link(bar) or */Discussion") {
%IkiWiki::depends_simple=();
%IkiWiki::depends=();
}
-
-}