X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=t%2F800_shikabased%2F010-isa-or.t;h=b912815b94a1ca08e9740617959f5aff0c692646;hp=ef867433ade8f88f2daef1df96c39eb6486116e3;hb=a09601ab6f3b4b6efb78d3f24a050fec92dcf02f;hpb=bf8e5b90e442d6ec7dbb837a051f547d685ee2e9 diff --git a/t/800_shikabased/010-isa-or.t b/t/800_shikabased/010-isa-or.t index ef86743..b912815 100644 --- a/t/800_shikabased/010-isa-or.t +++ b/t/800_shikabased/010-isa-or.t @@ -7,14 +7,17 @@ use Test::More tests => 18; use Mouse; use Mouse::Util::TypeConstraints; type Baz => where { defined($_) && $_ eq 'Baz' }; + coerce Baz => from 'ArrayRef', via { 'Baz' }; + has 'bar' => ( is => 'rw', isa => 'Str | Baz | Undef', coerce => 1 ); } eval { Foo->new( bar => +{} ); }; -like($@, qr/^Attribute \(bar\) does not pass the type constraint because: Validation failed for 'Str\|Baz\|Undef' failed with value HASH\(\w+\)/, 'type constraint and coercion failed'); +like($@, qr/^Attribute \(bar\) does not pass the type constraint because: Validation failed for 'Str\|Baz\|Undef' failed with value HASH\(\w+\)/, 'type constraint and coercion failed') + or diag "\$@='$@'"; eval { isa_ok(Foo->new( bar => undef ), 'Foo'); @@ -69,7 +72,7 @@ is $foo->foo, 'Name', 'foo is Name'; { package KLASS; - sub new { bless {}, shift }; + use Mouse; } { package Funk;