X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F040_type_constraints%2F005_util_type_coercion.t;h=c60cf5b8e78f42cc17d068e9e99b5e0b8e7fd6c1;hb=be0ed15704fdad5f2d8517380a6f24687432c1dd;hp=86a158ca37c16e59b766b37dd64380320a4ab7b0;hpb=d03bd989b97597428b460d7f9a021e2931893fa0;p=gitmo%2FMoose.git diff --git a/t/040_type_constraints/005_util_type_coercion.t b/t/040_type_constraints/005_util_type_coercion.t index 86a158c..c60cf5b 100644 --- a/t/040_type_constraints/005_util_type_coercion.t +++ b/t/040_type_constraints/005_util_type_coercion.t @@ -3,11 +3,11 @@ use strict; use warnings; -use Test::More tests => 26; -use Test::Exception; +use Test::More; +use Test::Fatal; BEGIN { - use_ok('Moose::Util::TypeConstraints'); + use_ok('Moose::Util::TypeConstraints'); } { @@ -40,13 +40,13 @@ ok(!Header({}), '... this did not pass the type test'); my $anon_type = subtype Object => where { $_->isa('HTTPHeader') }; -lives_ok { +ok ! exception { coerce $anon_type => from ArrayRef => via { HTTPHeader->new(array => $_[0]) } => from HashRef => via { HTTPHeader->new(hash => $_[0]) }; -} 'coercion of anonymous subtype succeeds'; +}, 'coercion of anonymous subtype succeeds'; foreach my $coercion ( find_type_constraint('Header')->coercion, @@ -100,3 +100,5 @@ coerce 'StrWithTrailingX' my $tc = find_type_constraint('StrWithTrailingX'); is($tc->coerce("foo"), "fooX", "coerce when needed"); is($tc->coerce("fooX"), "fooX", "do not coerce when unneeded"); + +done_testing;