diff options
author | Joey Hess <joey@kitenet.net> | 2010-04-21 23:08:54 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-04-21 23:08:54 -0400 |
commit | c98414e192285b2607ee9fcb27f0e8e00db5fb26 (patch) | |
tree | 266fe05e6827cbcd3f3ac4e7c5ca1756d0969b89 /t | |
parent | 13325317a32529e02769baa5e61e6c401c675b27 (diff) | |
download | ikiwiki-c98414e192285b2607ee9fcb27f0e8e00db5fb26.tar ikiwiki-c98414e192285b2607ee9fcb27f0e8e00db5fb26.tar.gz |
added a test case for this bug
Further analysis suggests fixing this might not be as dreadful as I first
thought!
Diffstat (limited to 't')
-rwxr-xr-x | t/pagespec_match_list.t | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/t/pagespec_match_list.t b/t/pagespec_match_list.t index ee5d60f88..27546e6ca 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 => 107; +use Test::More tests => 115; BEGIN { use_ok("IkiWiki"); } @@ -27,6 +27,8 @@ IkiWiki::checkconfig(); $IkiWiki::pagectime{foo} = 2; $IkiWiki::pagectime{foo2} = 2; $IkiWiki::pagectime{foo3} = 1; +$IkiWiki::pagectime{foo4} = 1; +$IkiWiki::pagectime{foo5} = 1; $IkiWiki::pagectime{bar} = 3; $IkiWiki::pagectime{"post/1"} = 6; $IkiWiki::pagectime{"post/2"} = 6; @@ -69,12 +71,28 @@ foreach my $spec ("* and link(bar)", "* or link(bar)") { 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); + ok($IkiWiki::depends_simple{foo2}{foo} != $IkiWiki::DEPEND_LINKS); %IkiWiki::depends_simple=(); %IkiWiki::depends=(); pagespec_match_list("foo3", $spec, deptype => deptype("links")); ok($IkiWiki::depends{foo3}{$spec} & $IkiWiki::DEPEND_LINKS); ok(! ($IkiWiki::depends{foo3}{$spec} & ($IkiWiki::DEPEND_CONTENT | $IkiWiki::DEPEND_PRESENCE))); ok($IkiWiki::depends_simple{foo3}{foo3} == $IkiWiki::DEPEND_LINKS); + ok($IkiWiki::depends_simple{foo3}{foo} != $IkiWiki::DEPEND_LINKS); + %IkiWiki::depends_simple=(); + %IkiWiki::depends=(); +} +# Above we tested that a link pagespec is influenced +# by the pages that currently contain the link. + +# Oppositely, a pagespec that tests for pages that do not have a link +# is not influenced by pages that currently contain the link, but +# is instead influenced by pages that currently do not (but that +# could be changed to have it). +foreach my $spec ("* and !link(bar)", "* and !(!(!link(bar)))") { + pagespec_match_list("foo2", $spec); + ok($IkiWiki::depends_simple{foo2}{foo2} != $IkiWiki::DEPEND_LINKS); + ok($IkiWiki::depends_simple{foo2}{foo} == $IkiWiki::DEPEND_LINKS); %IkiWiki::depends_simple=(); %IkiWiki::depends=(); } |