X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F020_attributes%2Ffailing%2F014_misc_attribute_coerce_lazy.t;fp=t%2F020_attributes%2Ffailing%2F014_misc_attribute_coerce_lazy.t;h=0000000000000000000000000000000000000000;hb=db53d2b4ec887312eff701faa1749e983182e5d0;hp=ccd88831ca4f8baeb91d03b96206f00ddf42c64c;hpb=620c3203b30d5e7644acd8769db61991edffc251;p=gitmo%2FMouse.git diff --git a/t/020_attributes/failing/014_misc_attribute_coerce_lazy.t b/t/020_attributes/failing/014_misc_attribute_coerce_lazy.t deleted file mode 100644 index ccd8883..0000000 --- a/t/020_attributes/failing/014_misc_attribute_coerce_lazy.t +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More tests => 2; -use Test::Exception; - - - -{ - package HTTPHeader; - use Mouse; - - has 'array' => (is => 'ro'); - has 'hash' => (is => 'ro'); -} - -{ - package Request; - use Mouse; - use Mouse::Util::TypeConstraints; - - subtype Header => - => as Object - => where { $_->isa('HTTPHeader') }; - - coerce Header - => from ArrayRef - => via { HTTPHeader->new(array => $_[0]) } - => from HashRef - => via { HTTPHeader->new(hash => $_[0]) }; - - has 'headers' => ( - is => 'rw', - isa => 'Header', - coerce => 1, - lazy => 1, - default => sub { [ 'content-type', 'text/html' ] } - ); -} - -my $r = Request->new; -isa_ok($r, 'Request'); - -lives_ok { - $r->headers; -} '... this coerces and passes the type constraint even with lazy'; - - -