From: Dave Rolsky Date: Sat, 25 Sep 2010 19:51:45 +0000 (-0500) Subject: More tests for array refs to make sure we test all code generation paths X-Git-Tag: 1.15~92 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bbeb5798151fa7d2dab0ed802db8199d257ab0e3;p=gitmo%2FMoose.git More tests for array refs to make sure we test all code generation paths --- diff --git a/t/070_native_traits/010_trait_array.t b/t/070_native_traits/010_trait_array.t index 7271f41..fbad78b 100644 --- a/t/070_native_traits/010_trait_array.t +++ b/t/070_native_traits/010_trait_array.t @@ -4,6 +4,7 @@ use strict; use warnings; use Moose (); +use Moose::Util::TypeConstraints; use Test::More; use Test::Exception; use Test::Moose; @@ -88,6 +89,15 @@ use Test::Moose; { run_tests(build_class); run_tests( build_class( lazy => 1, default => sub { [ 42, 84 ] } ) ); + + # Will force the inlining code to check the entire arrayref when it is modified. + subtype 'MyArrayRef', as 'ArrayRef', where { 1 }; + + run_tests( build_class( isa => 'MyArrayRef' ) ); + + coerce 'MyArrayRef', from 'ArrayRef', via { $_ }; + + run_tests( build_class( isa => 'MyArrayRef', coerce => 1 ) ); } sub run_tests {