]> sipb.mit.edu Git - ikiwiki.git/commitdiff
update
authorJoey Hess <joey@gnu.kitenet.net>
Sat, 10 Oct 2009 01:23:39 +0000 (21:23 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Sat, 10 Oct 2009 01:23:39 +0000 (21:23 -0400)
t/pagespec_match_result.t

index 2319d8733b333a2c4c46229af232b090a3c18395..d9c31d6f062a47b8d976b1bf14d54b247d11957b 100755 (executable)
@@ -1,15 +1,15 @@
 #!/usr/bin/perl
 use warnings;
 use strict;
-use Test::More tests => 67;
+use Test::More tests => 71;
 
 BEGIN { use_ok("IkiWiki"); }
 
 # Note that new objects have to be constructed freshly for each test, since
 # object states are mutated as they are combined.
-sub S { IkiWiki::SuccessReason->new("match") }
-sub F { IkiWiki::FailReason->new("no match") }
-sub E { IkiWiki::ErrorReason->new("error in matching") }
+sub S { IkiWiki::SuccessReason->new("match", @_) }
+sub F { IkiWiki::FailReason->new("no match", @_) }
+sub E { IkiWiki::ErrorReason->new("error in matching", @_) }
 
 ok(S() eq "match");
 ok(F() eq "no match");
@@ -38,12 +38,10 @@ ok(S() & (F() | F() | S()));
 # as long as the two items are always both present
 foreach my $op ('$s | $f', '$s & $f', '$s & $f & E()', '$s | E() | $f',
                 '! $s | ! $f', '!(!(!$s)) | $f') {
-       my $s=S();
-       $s->influences(foo => 1, bar => 1);
+       my $s=S(foo => 1, bar => 1);
        is($s->influences->{foo}, 1);
        is($s->influences->{bar}, 1);
-       my $f=F();
-       $f->influences(bar => 2, baz => 1);
+       my $f=F(bar => 2, baz => 1);
        is($f->influences->{bar}, 2);
        is($f->influences->{baz}, 1);
        my $c = eval $op;
@@ -52,3 +50,10 @@ foreach my $op ('$s | $f', '$s & $f', '$s & $f & E()', '$s | E() | $f',
        is($c->influences->{bar}, (1 | 2), "bar ($op)");
        is($c->influences->{baz}, 1, "baz ($op)");
 }
+
+my $s=S(foo => 0, bar => 1);
+$s->influences(baz => 1);
+ok(! $s->influences->{foo}, "removed 0 influence");
+ok(! $s->influences->{bar}, "removed 1 influence");
+ok($s->influences->{baz}, "set influence");
+ok($s->influences_static);