X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F040_type_constraints%2F007_util_more_type_coercion.t;h=cd29ea0ab93df221372cb8f8e6a1c01ae8cd6b47;hb=d03bd989b97597428b460d7f9a021e2931893fa0;hp=2bcafc14bc79fcd53c01b0cbd8afec6887e1202b;hpb=f6bee6fe1d579dc3d2ed2952cce9a1556040c8e5;p=gitmo%2FMoose.git diff --git a/t/040_type_constraints/007_util_more_type_coercion.t b/t/040_type_constraints/007_util_more_type_coercion.t index 2bcafc1..cd29ea0 100644 --- a/t/040_type_constraints/007_util_more_type_coercion.t +++ b/t/040_type_constraints/007_util_more_type_coercion.t @@ -12,24 +12,24 @@ use Test::Exception; package HTTPHeader; use Moose; use Moose::Util::TypeConstraints; - + coerce 'HTTPHeader' - => from ArrayRef + => from ArrayRef => via { HTTPHeader->new(array => $_[0]) }; - + coerce 'HTTPHeader' - => from HashRef - => via { HTTPHeader->new(hash => $_[0]) }; - + => from HashRef + => via { HTTPHeader->new(hash => $_[0]) }; + has 'array' => (is => 'ro'); - has 'hash' => (is => 'ro'); + has 'hash' => (is => 'ro'); package Engine; use strict; use warnings; use Moose; - - has 'header' => (is => 'rw', isa => 'HTTPHeader', coerce => 1); + + has 'header' => (is => 'rw', isa => 'HTTPHeader', coerce => 1); } { @@ -63,11 +63,11 @@ use Test::Exception; ok(!defined($engine->header->array), '... no array value set'); dies_ok { - $engine->header("Foo"); + $engine->header("Foo"); } '... dies with the wrong type, even after coercion'; lives_ok { - $engine->header(HTTPHeader->new); + $engine->header(HTTPHeader->new); } '... lives with the right type, even after coercion'; }