X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F010_basics%2F012_rebless.t;h=1004720de85915fec9fbb739cfcf0c541a2df985;hb=be0ed15704fdad5f2d8517380a6f24687432c1dd;hp=2ec0c205a57f3269fab91587c865dd14f4974517;hpb=d26c82ab01d405ba41f1c28cdd2f2c8ffa215de1;p=gitmo%2FMoose.git diff --git a/t/010_basics/012_rebless.t b/t/010_basics/012_rebless.t index 2ec0c20..1004720 100644 --- a/t/010_basics/012_rebless.t +++ b/t/010_basics/012_rebless.t @@ -4,7 +4,7 @@ use strict; use warnings; use Test::More; -use Test::Exception; +use Test::Fatal; use Scalar::Util 'blessed'; use Moose::Util::TypeConstraints; @@ -58,13 +58,13 @@ my $bar = Parent->new; is(blessed($foo), 'Parent', 'Parent->new gives a Parent object'); is($foo->name, undef, 'No name yet'); is($foo->lazy_classname, 'Parent', "lazy attribute initialized"); -lives_ok { $foo->type_constrained(10.5) } "Num type constraint for now.."; +ok ! exception { $foo->type_constrained(10.5) }, "Num type constraint for now.."; # try to rebless, except it will fail due to Child's stricter type constraint -throws_ok { Child->meta->rebless_instance($foo) } +like exception { Child->meta->rebless_instance($foo) }, qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' with value 10\.5/, '... this failed cause of type check'; -throws_ok { Child->meta->rebless_instance($bar) } +like exception { Child->meta->rebless_instance($bar) }, qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' with value 5\.5/, '... this failed cause of type check';; @@ -80,7 +80,7 @@ is($foo->name, 'Junior', "Child->name's default came through"); is($foo->lazy_classname, 'Parent', "lazy attribute was already initialized"); is($bar->lazy_classname, 'Child', "lazy attribute just now initialized"); -throws_ok { $foo->type_constrained(10.5) } +like exception { $foo->type_constrained(10.5) }, qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' with value 10\.5/, '... this failed cause of type check';