X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ftype_constraints%2Futil_std_type_constraints.t;h=12ca75a5fa372b0068697356338d314e3496859c;hb=57324ff5c1e2f26b2ec5ccb022e708be66ee2ede;hp=0aaf02c50c88ae4c65e3d8ee93e0b7d55cc02a80;hpb=6b5fae23bfd9bc417062c7921bfbcc986c772a7b;p=gitmo%2FMoose.git diff --git a/t/type_constraints/util_std_type_constraints.t b/t/type_constraints/util_std_type_constraints.t index 0aaf02c..12ca75a 100644 --- a/t/type_constraints/util_std_type_constraints.t +++ b/t/type_constraints/util_std_type_constraints.t @@ -5,6 +5,7 @@ use warnings; use Test::More; +use Eval::Closure; use IO::File; use Moose::Util::TypeConstraints; use Scalar::Util qw( blessed openhandle ); @@ -731,9 +732,9 @@ for my $name ( sort keys %tests ) { my $inlined; { - local $@; - $inlined = eval 'sub { ( ' . $type->_inline_check('$_[0]') . ' ) }'; - die $@ if $@; + $inlined = eval_closure( + source => 'sub { ( ' . $type->_inline_check('$_[0]') . ' ) }', + ); } ok( @@ -1011,9 +1012,10 @@ sub test_constraint { my $inlined; if ( $type->has_inlined_type_constraint ) { - local $@; - $inlined = eval 'sub { ( ' . $type->_inline_check('$_[0]') . ' ) }'; - die $@ if $@; + $inlined = eval_closure( + source => 'sub { ( ' . $type->_inline_check('$_[0]') . ' ) }', + environment => $type->inline_environment, + ); } for my $accept ( @{ $tests->{accept} || [] } ) {