From: Dave Rolsky Date: Thu, 15 Jul 2010 14:48:59 +0000 (-0500) Subject: No need to create a class to test whether a type has a coercion X-Git-Tag: 0.23~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Types.git;a=commitdiff_plain;h=9f6c7824c2d808539307996cf106d8515e0c1537 No need to create a class to test whether a type has a coercion --- diff --git a/t/21_coerce_parameterized_types.t b/t/21_coerce_parameterized_types.t index ae1ef9a..5b43aa3 100644 --- a/t/21_coerce_parameterized_types.t +++ b/t/21_coerce_parameterized_types.t @@ -31,25 +31,19 @@ BEGIN { [split //] }; } + { - package AClass; - use Moose; BEGIN { TypeLib->import(qw/ MyChar MyDigit ArrayRefOfMyCharOrDigit/ ) }; use MooseX::Types::Moose 'ArrayRef'; - local *Moose::Deprecated::deprecated = sub { }; - has parameterized => (is => 'rw', isa => ArrayRef[MyChar|MyDigit], coerce => 1); - has subtype_parameterized => (is => 'rw', isa => ArrayRefOfMyCharOrDigit, coerce => 1); -} - -my $instance = AClass->new; + my $parameterized = ArrayRef[MyChar|MyDigit]; + { local $::TODO = "see comments in MooseX::Types->create_arged_..."; + ::ok( $parameterized->has_coercion, 'coercion applied to parameterized type' ); + } -{ local $TODO = "see comments in MooseX::Types->create_arged_..."; -lives_ok { $instance->parameterized('foo') } - 'coercion applied to parameterized type'; + my $subtype = ArrayRefOfMyCharOrDigit; + ::ok( $subtype->has_coercion, 'coercion applied to subtype' ); } -lives_ok { $instance->subtype_parameterized('foo') } - 'coercion applied to subtype';