Redid conversion to Test::Fatal
[gitmo/Moose.git] / t / 050_metaclasses / 013_metaclass_traits.t
index 7823237..a96d95e 100644 (file)
@@ -167,11 +167,14 @@ is( Role::Foo->meta()->simple(), 5,
 
 {
     require Moose::Util::TypeConstraints;
-    my $error;
-    ok($error = exception { Moose::Util::TypeConstraints->import( -traits => 'My::SimpleTrait' ) },
-             'cannot provide -traits to an exporting module that does not init_meta');
-    like( $error, qr/does not have an init_meta/,
-          '... and error provides a useful explanation' );
+    like(
+        exception {
+            Moose::Util::TypeConstraints->import(
+                -traits => 'My::SimpleTrait' );
+        },
+        qr/does not have an init_meta/,
+        'cannot provide -traits to an exporting module that does not init_meta'
+    );
 }
 
 {
@@ -199,11 +202,10 @@ is( Foo::Subclass->meta()->attr2(), 'something',
     has an_attr => ( is => 'ro' );
 }
 
-ok ! exception {
+is( exception {
     my $instance = Class::WithAlreadyPresentTrait->new( an_attr => 'value' );
     is( $instance->an_attr, 'value', 'Can get value' );
-},
-'Can create instance and access attributes';
+}, undef, 'Can create instance and access attributes' );
 
 {
 
@@ -216,10 +218,9 @@ ok ! exception {
     has an_attr => ( is => 'ro' );
 }
 
-ok ! exception {
+is( exception {
     my $instance = Class::WhichLoadsATraitFromDisk->new( an_attr => 'value' );
     is( $instance->an_attr, 'value', 'Can get value' );
-},
-'Can create instance and access attributes';
+}, undef, 'Can create instance and access attributes' );
 
 done_testing;