From: Karen Etheridge Date: Thu, 21 Oct 2010 20:38:52 +0000 (-0700) Subject: add another test to confirm that the coercion is run on the resulting arrayref, as... X-Git-Tag: 1.18~73 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0af620533324e635c2398451ecfc3f12029b9e1;p=gitmo%2FMoose.git add another test to confirm that the coercion is run on the resulting arrayref, as well as each element --- diff --git a/t/070_native_traits/013_array_coerce.t b/t/070_native_traits/013_array_coerce.t index 0b54582..26d1920 100644 --- a/t/070_native_traits/013_array_coerce.t +++ b/t/070_native_traits/013_array_coerce.t @@ -117,7 +117,8 @@ my $foo = Foo->new; => via { Thing->new( thing => $_ ) }; subtype 'ArrayRefOfThings' - => as 'ArrayRef[Thing]'; + => as 'ArrayRef[Thing]' + => where { scalar(@$_) < 5 }; coerce 'ArrayRefOfThings' => from 'ArrayRef[Str]' @@ -143,11 +144,14 @@ my $foo = Foo->new; TODO: { my $bar = Bar->new( array => [qw( a b c )] ); - todo_skip 'coercion in push dies here!', 1; + todo_skip 'coercion in push dies here!', 2; $bar->push_array('d'); is( $bar->get_array(3)->thing, 'd', 'push coerces the array' ); + + dies_ok { $bar->push_array('e') } + 'the type constraint prohibits arrays of length 5'; } done_testing;