convert all uses of Test::Exception to Test::Fatal.
[gitmo/Moose.git] / t / 030_roles / 003_apply_role.t
index e58c0e2..b31caf1 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 {
     package FooRole;
@@ -46,11 +46,11 @@ use Test::Exception;
 
     extends 'BarClass';
 
-    ::throws_ok { with 'FooRole' => { -version => 42 } }
+    ::like ::exception { with 'FooRole' => { -version => 42 } },
         qr/FooRole version 42 required--this is only version 23/,
         'applying role with unsatisfied version requirement';
 
-    ::lives_ok { with 'FooRole' => { -version => 13 } }
+    ::ok ! ::exception { with 'FooRole' => { -version => 13 } },
         'applying role with satisfied version requirement';
 
     sub blau {'FooClass::blau'}    # << the role wraps this ...
@@ -72,19 +72,19 @@ isa_ok( $foo_class_meta, 'Moose::Meta::Class' );
 my $foobar_class_meta = FooBarClass->meta;
 isa_ok( $foobar_class_meta, 'Moose::Meta::Class' );
 
-dies_ok {
+ok exception {
     $foo_class_meta->does_role();
-}
+},
 '... does_role requires a role name';
 
-dies_ok {
+ok exception {
     $foo_class_meta->add_role();
-}
+},
 '... apply_role requires a role';
 
-dies_ok {
+ok exception {
     $foo_class_meta->add_role( bless( {} => 'Fail' ) );
-}
+},
 '... apply_role requires a role';
 
 ok( $foo_class_meta->does_role('FooRole'),
@@ -171,22 +171,22 @@ foreach my $foo ( $foo, $foobar ) {
     ok( !defined( $foo->baz ), '... $foo->baz is undefined' );
     ok( !defined( $foo->bar ), '... $foo->bar is undefined' );
 
-    dies_ok {
+    ok exception {
         $foo->baz(1);
-    }
+    },
     '... baz is a read-only accessor';
 
-    dies_ok {
+    ok exception {
         $foo->bar(1);
-    }
+    },
     '... bar is a read-write accessor with a type constraint';
 
     my $foo2 = FooClass->new();
     isa_ok( $foo2, 'FooClass' );
 
-    lives_ok {
+    ok ! exception {
         $foo->bar($foo2);
-    }
+    },
     '... bar is a read-write accessor with a type constraint';
 
     is( $foo->bar, $foo2, '... got the right value for bar now' );