diff options
author | doy <doy@tozt.net> | 2008-12-06 23:54:07 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2008-12-06 23:54:07 -0500 |
commit | 254e8b9c08249f1fa8119d49b3eaf2f91c680018 (patch) | |
tree | d27834b73b564683c08cdfafa7a654cb0aa8f8dd | |
parent | 6bbd36711c3a8ddc93a949b1c254ce33824659d4 (diff) | |
download | moosex-role-matcher-254e8b9c08249f1fa8119d49b3eaf2f91c680018.tar.gz moosex-role-matcher-254e8b9c08249f1fa8119d49b3eaf2f91c680018.zip |
add more tests
-rw-r--r-- | t/001-basic-matching.t | 8 | ||||
-rw-r--r-- | t/002-complicated-matching.t | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/t/001-basic-matching.t b/t/001-basic-matching.t index 52003ac..45852ca 100644 --- a/t/001-basic-matching.t +++ b/t/001-basic-matching.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 5; +use Test::More tests => 8; package Foo; use Moose; @@ -25,3 +25,9 @@ ok($foo->match(a => 'foo', b => qr/a/, c => sub { substr(shift, 2) eq 'z' }), $foo = Foo->new(a => 'foo'); ok($foo->match(a => 'foo', b => undef), 'matching against undef works'); +ok($foo->match(a => 'foo', d => undef), + 'matching against undef works even when the method doesn\'t exist'); +ok(!$foo->match(a => undef), + 'matching undef against a method with a value fails'); +ok(!$foo->match(b => 'foo'), + 'matching against a method with an undef value fails'); diff --git a/t/002-complicated-matching.t b/t/002-complicated-matching.t index 80d081c..1c0a7b9 100644 --- a/t/002-complicated-matching.t +++ b/t/002-complicated-matching.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 5; package Foo; use Moose; @@ -23,3 +23,5 @@ ok(!$foo->match(a => [qr/b/, sub { length(shift) == 4 }]), 'arrayref matching works'); ok($foo->match('!a' => 'bar', b => 'bar', '!c' => 'bar'), 'negated matching works'); +ok(!$foo->match(a => 'foo', '!b' => 'bar'), + 'negated matching works'); |