From: Dave Rolsky Date: Sat, 25 Sep 2010 19:53:38 +0000 (-0500) Subject: More tests for Hash trait to ensure we test all code gen paths X-Git-Tag: 1.15~89 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6197a68c77dfde0627d06209e069c2b00f302f0f;p=gitmo%2FMoose.git More tests for Hash trait to ensure we test all code gen paths --- diff --git a/t/070_native_traits/050_trait_hash.t b/t/070_native_traits/050_trait_hash.t index 824f718..4a1cf76 100644 --- a/t/070_native_traits/050_trait_hash.t +++ b/t/070_native_traits/050_trait_hash.t @@ -4,6 +4,7 @@ use strict; use warnings; use Moose (); +use Moose::Util::TypeConstraints; use Test::Exception; use Test::More; use Test::Moose; @@ -53,6 +54,15 @@ use Test::Moose; { run_tests(build_class); run_tests( build_class( lazy => 1, default => sub { { x => 1 } } ) ); + + # Will force the inlining code to check the entire hashref when it is modified. + subtype 'MyHashRef', as 'HashRef[Str]', where { 1 }; + + run_tests( build_class( isa => 'MyHashRef' ) ); + + coerce 'MyHashRef', from 'HashRef', via { $_ }; + + run_tests( build_class( isa => 'MyHashRef', coerce => 1 ) ); } sub run_tests {