Fix test description
[gitmo/Moose.git] / t / 050_metaclasses / 012_moose_exporter.t
index d693b83..98bde56 100644 (file)
@@ -4,12 +4,11 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Exception;
-BEGIN {
-    eval "use Test::Output;";
-    plan skip_all => "Test::Output is required for this test" if $@;
-}
+use Test::Fatal;
 
+use Test::Requires {
+    'Test::Output' => '0.01', # skip all if not installed
+};
 
 {
     package HasOwnImmutable;
@@ -198,19 +197,13 @@ BEGIN {
 
     use Moose ();
 
-    ::dies_ok(
-        sub {
-            Moose::Exporter->setup_import_methods(
+    ::like(
+        ::exception{ Moose::Exporter->setup_import_methods(
                 also => [ 'Moose', 'MooseX::CircularAlso' ],
             );
-        },
-        'a circular reference in also dies with an error'
-    );
-
-    ::like(
-        $@,
+            },
         qr/\QCircular reference in 'also' parameter to Moose::Exporter between MooseX::CircularAlso and MooseX::CircularAlso/,
-        'got the expected error from circular reference in also'
+        'a circular reference in also dies with an error'
     );
 }
 
@@ -219,19 +212,13 @@ BEGIN {
 
     use Moose ();
 
-    ::dies_ok(
-        sub {
-            Moose::Exporter->setup_import_methods(
-                also => [ 'NoSuchThing' ],
-            );
-        },
-        'a package which does not use Moose::Exporter in also dies with an error'
-    );
-
     ::like(
-        $@,
+        ::exception{ Moose::Exporter->setup_import_methods(
+                also => ['NoSuchThing'],
+            );
+            },
         qr/\QPackage in also (NoSuchThing) does not seem to use Moose::Exporter (is it loaded?) at /,
-        'got the expected error from a reference in also to a package which is not loaded'
+        'a package which does not use Moose::Exporter in also dies with an error'
     );
 }
 
@@ -240,19 +227,13 @@ BEGIN {
 
     use Moose ();
 
-    ::dies_ok(
-        sub {
-            Moose::Exporter->setup_import_methods(
-                also => [ 'Moose::Meta::Method' ],
-            );
-        },
-        'a package which does not use Moose::Exporter in also dies with an error'
-    );
-
     ::like(
-        $@,
+        ::exception{ Moose::Exporter->setup_import_methods(
+                also => ['Moose::Meta::Method'],
+            );
+            },
         qr/\QPackage in also (Moose::Meta::Method) does not seem to use Moose::Exporter at /,
-        'got the expected error from a reference in also to a package which does not use Moose::Exporter'
+        'a package which does not use Moose::Exporter in also dies with an error'
     );
 }