X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F100_bugs%2F017_type_constraint_messages.t;h=a8fcf102858daed9682d626de1be077d8f182742;hb=4acaa12eea4d2dadc3b1e5d6eac8f08edb54bef6;hp=6740e815ab2c1815bf86e8bc9c9be7dd776ea26a;hpb=e606ae5f848070d889472329819c95f5ba763ca3;p=gitmo%2FMoose.git diff --git a/t/100_bugs/017_type_constraint_messages.t b/t/100_bugs/017_type_constraint_messages.t index 6740e81..a8fcf10 100644 --- a/t/100_bugs/017_type_constraint_messages.t +++ b/t/100_bugs/017_type_constraint_messages.t @@ -3,9 +3,8 @@ use strict; use warnings; -use Test::More no_plan => 1; -use Test::Exception; - +use Test::More; +use Test::Fatal; # RT #37569 @@ -21,7 +20,7 @@ use Test::Exception; subtype 'MyArrayRef' => as 'ArrayRef' => where { defined $_->[0] } - => message { ref $_ ? "ref: ". ref $_ : 'scalar' } # stringy + => message { ref $_ ? "ref: ". ref $_ : 'scalar' } # stringy ; subtype 'MyObjectType' @@ -53,16 +52,22 @@ use Test::Exception; my $foo = Foo->new; my $obj = MyObject->new; -throws_ok { - $foo->ar([]); -} qr/Attribute \(ar\) does not pass the type constraint because: ref: ARRAY/, '... got the right error message'; - -throws_ok { - $foo->obj($foo); # Doh! -} qr/Attribute \(obj\) does not pass the type constraint because: Well it is an object/, '... got the right error message'; - -throws_ok { - $foo->nt($foo); # scalar -} qr/Attribute \(nt\) does not pass the type constraint because: blessed/, '... got the right error message'; - - +like exception { + $foo->ar( [] ); +}, +qr/Attribute \(ar\) does not pass the type constraint because: ref: ARRAY/, + '... got the right error message'; + +like exception { + $foo->obj($foo); # Doh! +}, +qr/Attribute \(obj\) does not pass the type constraint because: Well it is an object/, + '... got the right error message'; + +like exception { + $foo->nt($foo); # scalar +}, +qr/Attribute \(nt\) does not pass the type constraint because: blessed/, + '... got the right error message'; + +done_testing;