X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/85af97c9a2311bc6c2606e43aeaf83f7a30e0514..11fc28970b329334d88d3667e5b55e0d57e353ab:/t/pagespec_match_list.t diff --git a/t/pagespec_match_list.t b/t/pagespec_match_list.t index 301197cc1..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 => 49; +use Test::More tests => 88; BEGIN { use_ok("IkiWiki"); } @@ -82,4 +82,31 @@ foreach my $spec ("bar or (backlink(foo) and !*.png)", "backlink(foo)") { ok($IkiWiki::depends{foo2}{$spec} & $IkiWiki::DEPEND_CONTENT); ok(! ($IkiWiki::depends{foo2}{$spec} & ($IkiWiki::DEPEND_PRESENCE | $IkiWiki::DEPEND_LINKS))); ok($IkiWiki::depends_simple{foo2}{foo} == $IkiWiki::DEPEND_LINKS); + %IkiWiki::depends_simple=(); + %IkiWiki::depends=(); +} + +# 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}, "no influence from $spec"); + %IkiWiki::depends_simple=(); + %IkiWiki::depends=(); +} + +# 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))); + ok($IkiWiki::depends_simple{foo2}{foo2} == $IkiWiki::DEPEND_LINKS); + %IkiWiki::depends_simple=(); + %IkiWiki::depends=(); }