X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F04-map.t;h=a1f0a5660b0815f9e12561e24ce7916a0e993e17;hb=25c705c4f401f9a52eba667e8c72720ace257be6;hp=636b11d50f9d9e03232b23bc3727673a4240e16a;hpb=382af4f1f4ac5d0e5861e90c308a53c5879665e4;p=gitmo%2FMooseX-Types-Structured.git diff --git a/t/04-map.t b/t/04-map.t index 636b11d..a1f0a56 100644 --- a/t/04-map.t +++ b/t/04-map.t @@ -1,6 +1,7 @@ use strict; use warnings; use Test::More; +use Test::Fatal; use MooseX::Types::Moose qw(Int Num); use MooseX::Types::Structured qw(Map); @@ -9,11 +10,11 @@ my $type = Map[ Int, Num ]; ok($type->assert_valid({ 10 => 10.5 }), "simple Int -> Num mapping"); -eval { $type->assert_valid({ 10.5 => 10.5 }) }; -like($@, qr{value 10\.5}, "non-Int causes rejection on key"); +like( exception { $type->assert_valid({ 10.5 => 10.5 }) }, + qr{value 10\.5}, "non-Int causes rejection on key"); -eval { $type->assert_valid({ 10 => "ten and a half" }) }; -like("$@", qr{value ten and a half}, "non-Num value causes rejection on value"); +like( exception { $type->assert_valid({ 10 => "ten and a half" }) }, + qr{value ten and a half}, "non-Num value causes rejection on value"); ok($type->assert_valid({ }), "empty hashref is a valid mapping of any sort");