From 254e8b9c08249f1fa8119d49b3eaf2f91c680018 Mon Sep 17 00:00:00 2001 From: doy Date: Sat, 6 Dec 2008 23:54:07 -0500 Subject: add more tests --- t/001-basic-matching.t | 8 +++++++- 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'); -- cgit v1.2.3