From: Shawn M Moore Date: Tue, 10 Jun 2008 01:57:54 +0000 (+0000) Subject: Test that a badly typed default explodes X-Git-Tag: 0.04~74 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e3d9dc7bc964416439c935152c3670e90a1cd315;p=gitmo%2FMouse.git Test that a badly typed default explodes --- diff --git a/t/025-more-isa.t b/t/025-more-isa.t index a457fa7..213fba8 100644 --- a/t/025-more-isa.t +++ b/t/025-more-isa.t @@ -1,7 +1,7 @@ #!/usr/bin/env perl use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 9; use Test::Exception; do { @@ -39,3 +39,21 @@ throws_ok { Class->new(tb => Class->new); } qr/Attribute \(tb\) does not pass the type constraint because: Validation failed for 'Test::Builder' failed with value Class=HASH\(\w+\)/; +do { + package Other; + use Mouse; + + has oops => ( + isa => 'Int', + default => "yikes", + ); +}; + +throws_ok { + Other->new; +} qr/Attribute \(oops\) does not pass the type constraint because: Validation failed for 'Int' failed with value yikes/; + +lives_ok { + Other->new(oops => 10); +}; +