Credit changes for Test::Fatal
[gitmo/Class-MOP.git] / t / 500_deprecated.t
index 3f1337d..471fb4a 100755 (executable)
@@ -1,8 +1,8 @@
 use strict;
 use warnings;
 
-use Test::More tests => 7;
-use Test::Exception;
+use Test::More;
+use Test::Fatal;
 
 use Carp;
 
@@ -11,40 +11,29 @@ $SIG{__WARN__} = \&croak;
 {
     package Foo;
 
-    ::throws_ok{
+    ::like( ::exception {
         Class::MOP::in_global_destruction();
-        } qr/\b deprecated \b/xmsi,
-        'Class::MOP::in_global_destruction is deprecated';
+        }, qr/\b deprecated \b/xmsi, 'Class::MOP::in_global_destruction is deprecated' );
 }
 
 {
     package Bar;
 
-    use Class::MOP::Deprecated -compatible => 0.93;
+    use Class::MOP::Deprecated -api_version => 0.93;
 
-    ::throws_ok{
+    ::like( ::exception {
         Class::MOP::in_global_destruction();
-        } qr/\b deprecated \b/xmsi,
-        'Class::MOP::in_global_destruction is deprecated with 0.93 compatibility';
+        }, qr/\b deprecated \b/xmsi, 'Class::MOP::in_global_destruction is deprecated with 0.93 compatibility' );
 }
 
 {
     package Baz;
 
-    use Class::MOP::Deprecated -compatible => 0.92;
+    use Class::MOP::Deprecated -api_version => 0.92;
 
-    ::lives_ok{
+    ::is( ::exception {
         Class::MOP::in_global_destruction();
-        }
-        'Class::MOP::in_global_destruction is not deprecated with 0.92 compatibility';
-}
-
-{
-    package Baz::Inner;
-
-    ::lives_ok{
-        Class::MOP::in_global_destruction();
-        } 'safe in an inner class';
+        }, undef, 'Class::MOP::in_global_destruction is not deprecated with 0.92 compatibility' );
 }
 
 {
@@ -52,15 +41,13 @@ $SIG{__WARN__} = \&croak;
 
     use metaclass;
 
-    ::throws_ok{ Foo2->meta->get_attribute_map }
-        qr/\Qget_attribute_map method has been deprecated/,
-        'get_attribute_map is deprecated';
+    ::like( ::exception { Foo2->meta->get_attribute_map }, qr/\Qget_attribute_map method has been deprecated/, 'get_attribute_map is deprecated' );
 }
 
 {
     package Quux;
 
-    use Class::MOP::Deprecated -compatible => 0.92;
+    use Class::MOP::Deprecated -api_version => 0.92;
     use Scalar::Util qw( blessed );
 
     use metaclass;
@@ -82,3 +69,5 @@ $SIG{__WARN__} = \&croak;
         'get_method_map returns expected methods'
     );
 }
+
+done_testing;