X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F070_native_traits%2F051_hash_subtypes.t;h=dfdbb637a2677b5b71230346df9995b360822d5e;hb=b10dde3a27c11623547417c599ccbd4f92e42651;hp=8949a926d7bcfe6897109ec39f53019b49f20339;hpb=d4e538d9bf46d1c14d2ecfd36ac35ed541ae7ee6;p=gitmo%2FMoose.git diff --git a/t/070_native_traits/051_hash_subtypes.t b/t/070_native_traits/051_hash_subtypes.t index 8949a92..dfdbb63 100644 --- a/t/070_native_traits/051_hash_subtypes.t +++ b/t/070_native_traits/051_hash_subtypes.t @@ -4,7 +4,7 @@ use strict; use warnings; use Test::More; -use Test::Exception; +use Test::Fatal; { use Moose::Util::TypeConstraints; @@ -66,8 +66,7 @@ my $foo = Foo->new; $foo->hash_int( {} ); is_deeply( $foo->hash_int, {}, "hash_int - correct contents" ); - dies_ok { $foo->set_hash_int( x => 'foo' ) } - "hash_int - can't set wrong type"; + isnt( exception { $foo->set_hash_int( x => 'foo' ) }, undef, "hash_int - can't set wrong type" ); is_deeply( $foo->hash_int, {}, "hash_int - correct contents" ); $foo->set_hash_int( x => 1 ); @@ -75,12 +74,12 @@ my $foo = Foo->new; } { - dies_ok { $foo->set_h1('foo') } "h1 - can't set onto undef"; + isnt( exception { $foo->set_h1('foo') }, undef, "h1 - can't set onto undef" ); $foo->h1( {} ); is_deeply( $foo->h1, {}, "h1 - correct contents" ); - dies_ok { $foo->set_h1( x => 'foo' ) } "h1 - can't set wrong type"; + isnt( exception { $foo->set_h1( x => 'foo' ) }, undef, "h1 - can't set wrong type" ); is_deeply( $foo->h1, {}, "h1 - correct contents" ); @@ -89,7 +88,7 @@ my $foo = Foo->new; } { - dies_ok { $foo->set_h2('foo') } "h2 - can't set onto undef"; + isnt( exception { $foo->set_h2('foo') }, undef, "h2 - can't set onto undef" ); $foo->h2( {} ); is_deeply( $foo->h2, {}, "h2 - correct contents" ); @@ -97,30 +96,27 @@ my $foo = Foo->new; $foo->set_h2( x => 'foo' ); is_deeply( $foo->h2, { x => 'foo' }, "h2 - correct contents" ); - dies_ok { $foo->set_h2( y => 'bar' ) } - "h2 - can't set more than one element"; + isnt( exception { $foo->set_h2( y => 'bar' ) }, undef, "h2 - can't set more than one element" ); is_deeply( $foo->h2, { x => 'foo' }, "h2 - correct contents" ); } { - dies_ok { $foo->set_h3(1) } "h3 - can't set onto undef"; + isnt( exception { $foo->set_h3(1) }, undef, "h3 - can't set onto undef" ); $foo->h3( {} ); is_deeply( $foo->h3, {}, "h3 - correct contents" ); - dies_ok { $foo->set_h3( x => 'foo' ) } "h3 - can't set non-int"; + isnt( exception { $foo->set_h3( x => 'foo' ) }, undef, "h3 - can't set non-int" ); - dies_ok { $foo->set_h3( x => 100 ) } - "h3 - can't violate overall type constraint"; + isnt( exception { $foo->set_h3( x => 100 ) }, undef, "h3 - can't violate overall type constraint" ); is_deeply( $foo->h3, {}, "h3 - correct contents" ); $foo->set_h3( x => 1 ); is_deeply( $foo->h3, { x => 1 }, "h3 - correct contents" ); - dies_ok { $foo->set_h3( x => 100 ) } - "h3 - can't violate overall type constraint"; + isnt( exception { $foo->set_h3( x => 100 ) }, undef, "h3 - can't violate overall type constraint" ); is_deeply( $foo->h3, { x => 1 }, "h3 - correct contents" );