From: Dave Rolsky Date: Mon, 19 Jul 2010 17:00:10 +0000 (-0500) Subject: Revert an earlier change (from master) so that we never try to call ->coerce on a... X-Git-Tag: 1.09~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4ee48f8eb1fcee3230aa1415b57a2eca6531186a;p=gitmo%2FMoose.git Revert an earlier change (from master) so that we never try to call ->coerce on a constraint unless it has a coercion. The new tests aren't done. --- diff --git a/t/100_bugs/030_coerce_without_coercion.t b/t/100_bugs/030_coerce_without_coercion.t new file mode 100644 index 0000000..413c965 --- /dev/null +++ b/t/100_bugs/030_coerce_without_coercion.t @@ -0,0 +1,32 @@ +use strict; +use warnings; + +use Test::More; +use Test::Exception; +use Test::Moose; + +{ + package Foo; + + use Moose::Deprecated -api_version => '1.08'; + use Moose; + + has x => ( + is => 'rw', + isa => 'HashRef', + coerce => 1, + ); +} + +with_immutable { + lives_ok { Foo->new( x => {} ) } + 'Setting coerce => 1 without a coercion on the type does not cause an error in the constructor'; + + lives_ok { Foo->new->x( {} ) } + 'Setting coerce => 1 without a coercion on the type does not cause an error when setting the attribut'; + + lives_ok { Foo->new( x => 42 ) } 'asasf'; +} +'Foo'; + +done_testing;