Redid conversion to Test::Fatal
[gitmo/Moose.git] / t / 040_type_constraints / 030_class_subtypes.t
index ec9a156..c5839c0 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Moose::Util::TypeConstraints;
 use Moose::Meta::TypeConstraint;
@@ -98,26 +98,26 @@ like $isa_foo->get_message( Baz->new ), qr/^Validation failed for 'IsaFoo' with
     );
 }
 
-throws_ok {
+like( exception {
     Quux->new(age => 3)
-} qr/^Attribute \(age\) does not pass the type constraint because: Validation failed for 'Positive' with value 3 \(not isa Positive\)/;
+}, qr/^Attribute \(age\) does not pass the type constraint because: Validation failed for 'Positive' with value 3 \(not isa Positive\)/ );
 
-lives_ok {
+is( exception {
     Quux->new(age => (bless {}, 'Positive'));
-};
+}, undef );
 
 eval "
     package Positive;
     use Moose;
 ";
 
-throws_ok {
+like( exception {
     Quux->new(age => 3)
-} qr/^Attribute \(age\) does not pass the type constraint because: Validation failed for 'Positive' with value 3 \(not isa Positive\)/;
+}, qr/^Attribute \(age\) does not pass the type constraint because: Validation failed for 'Positive' with value 3 \(not isa Positive\)/ );
 
-lives_ok {
+is( exception {
     Quux->new(age => Positive->new)
-};
+}, undef );
 
 class_type 'Negative' => message { "$_ is not a Negative Nancy" };
 
@@ -132,12 +132,12 @@ class_type 'Negative' => message { "$_ is not a Negative Nancy" };
     );
 }
 
-throws_ok {
+like( exception {
     Quux::Ier->new(age => 3)
-} qr/^Attribute \(age\) does not pass the type constraint because: 3 is not a Negative Nancy /;
+}, qr/^Attribute \(age\) does not pass the type constraint because: 3 is not a Negative Nancy / );
 
-lives_ok {
+is( exception {
     Quux::Ier->new(age => (bless {}, 'Negative'))
-};
+}, undef );
 
 done_testing;