X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F800_shikabased%2F010-isa-or.t;h=ef867433ade8f88f2daef1df96c39eb6486116e3;hb=684db121da77d6c63be5a58e33606907ca2aa4fb;hp=0991ab753f240d15e7e71529f85848a853f39a4a;hpb=3fa6f35df998618abdf763f4e4a060ba8f450a35;p=gitmo%2FMouse.git diff --git a/t/800_shikabased/010-isa-or.t b/t/800_shikabased/010-isa-or.t index 0991ab7..ef86743 100644 --- a/t/800_shikabased/010-isa-or.t +++ b/t/800_shikabased/010-isa-or.t @@ -14,7 +14,7 @@ use Test::More tests => 18; eval { Foo->new( bar => +{} ); }; -ok $@, 'not got an object'; +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'); eval { isa_ok(Foo->new( bar => undef ), 'Foo'); @@ -32,7 +32,7 @@ my $f = Foo->new; eval { $f->bar([]); }; -ok !$@; +ok !$@, $@; is $f->bar, 'Baz', 'bar is baz (coerce from ArrayRef)'; eval { @@ -72,7 +72,7 @@ is $foo->foo, 'Name', 'foo is Name'; sub new { bless {}, shift }; } { - package Baz; + package Funk; use Mouse; use Mouse::Util::TypeConstraints; @@ -82,10 +82,10 @@ is $foo->foo, 'Name', 'foo is Name'; has 'foo' => ( is => 'rw', isa => 'Type3|KLASS|Undef', coerce => 1 ); } -eval { Baz->new( foo => 'aaa' ) }; +eval { Funk->new( foo => 'aaa' ) }; like $@, qr/Attribute \(foo\) does not pass the type constraint because: Validation failed for 'Type3\|KLASS\|Undef' failed with value aaa/; -my $k = Baz->new; +my $k = Funk->new; ok $k, 'got an object 4'; $k->foo(sub {}); is $k->foo, 'Name', 'foo is Name';