summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoy <doy@tozt.net>2009-01-12 22:59:53 -0500
committerdoy <doy@tozt.net>2009-01-12 22:59:53 -0500
commitee8afbc45c13b4d20f8726d9b80a6a935c5c964e (patch)
treec1a3c4999f878335c83afe14d78666a076965f1c
parent3bee9f857af520c1b93192a003d252e0780110a9 (diff)
downloadmoosex-role-matcher-ee8afbc45c13b4d20f8726d9b80a6a935c5c964e.tar.gz
moosex-role-matcher-ee8afbc45c13b4d20f8726d9b80a6a935c5c964e.zip
add a couple more tests
-rw-r--r--t/004-submatching.t30
1 files changed, 29 insertions, 1 deletions
diff --git a/t/004-submatching.t b/t/004-submatching.t
index 3afd436..d3bb116 100644
--- a/t/004-submatching.t
+++ b/t/004-submatching.t
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 9;
package Bar;
use Moose;
@@ -52,6 +52,10 @@ package main;
a => 1,
}),
'simple submatching works');
+ ok(!$foo->match(bar => {
+ b => 1,
+ }),
+ 'simple submatching works');
ok($foo->match(bar => {
b => 2,
'!c' => sub { $_ > 5 },
@@ -86,6 +90,18 @@ package main;
},
}),
'deeper submatching works');
+ ok(!$foo->match(a => 3.14,
+ bar => {
+ a => 4,
+ },
+ baz => {
+ d => sub { length == 4 },
+ a => {
+ b => 5,
+ c => qr/\d/,
+ },
+ }),
+ 'deeper submatching works');
}
{
my $bar = Bar->new(a => 7, b => 'tmp', c => 9);
@@ -106,6 +122,18 @@ package main;
},
}),
'cyclical submatching works');
+ ok(!$foo->match(baz => {
+ c => {
+ c => {
+ e => {
+ c => {
+ b => 'quuux',
+ },
+ },
+ },
+ },
+ }),
+ 'cyclical submatching works');
ok($foo->match('!b' => sub { $_ % 2 },
bar => {
a => 7,