From ee8afbc45c13b4d20f8726d9b80a6a935c5c964e Mon Sep 17 00:00:00 2001 From: doy Date: Mon, 12 Jan 2009 22:59:53 -0500 Subject: add a couple more tests --- t/004-submatching.t | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) 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, -- cgit v1.2.3