Revert most of the conversion to Test::Fatal so we can redo it
[gitmo/Moose.git] / t / 020_attributes / 003_attribute_accessor_generation.t
index 532b558..0603f95 100644 (file)
@@ -4,7 +4,7 @@ use strict;
 use warnings;
 
 use Test::More;
-use Test::Fatal;
+use Test::Exception;
 
 use Scalar::Util 'isweak';
 
@@ -90,29 +90,29 @@ use Scalar::Util 'isweak';
 
     can_ok($foo, 'foo');
     is($foo->foo(), undef, '... got an unset value');
-    ok ! exception {
+    lives_ok {
         $foo->foo(100);
-    }, '... foo wrote successfully';
+    } '... foo wrote successfully';
     is($foo->foo(), 100, '... got the correct set value');
 
     ok(!isweak($foo->{foo}), '... it is not a weak reference');
 
     # required writer
 
-    ok exception {
+    dies_ok {
         Foo->new;
-    }, '... cannot create without the required attribute';
+    } '... cannot create without the required attribute';
 
     can_ok($foo, 'foo_required');
     is($foo->foo_required(), 'required', '... got an unset value');
-    ok ! exception {
+    lives_ok {
         $foo->foo_required(100);
-    }, '... foo_required wrote successfully';
+    } '... foo_required wrote successfully';
     is($foo->foo_required(), 100, '... got the correct set value');
 
-    ok ! exception {
+    lives_ok {
         $foo->foo_required(undef);
-    }, '... foo_required did not die with undef';
+    } '... foo_required did not die with undef';
 
     is($foo->foo_required, undef, "value is undef");
 
@@ -129,14 +129,14 @@ use Scalar::Util 'isweak';
 
     can_ok($foo, 'foo_int');
     is($foo->foo_int(), undef, '... got an unset value');
-    ok ! exception {
+    lives_ok {
         $foo->foo_int(100);
-    }, '... foo_int wrote successfully';
+    } '... foo_int wrote successfully';
     is($foo->foo_int(), 100, '... got the correct set value');
 
-    ok exception {
+    dies_ok {
         $foo->foo_int("Foo");
-    }, '... foo_int died successfully';
+    } '... foo_int died successfully';
 
     ok(!isweak($foo->{foo_int}), '... it is not a weak reference');
 
@@ -146,9 +146,9 @@ use Scalar::Util 'isweak';
 
     can_ok($foo, 'foo_weak');
     is($foo->foo_weak(), undef, '... got an unset value');
-    ok ! exception {
+    lives_ok {
         $foo->foo_weak($test);
-    }, '... foo_weak wrote successfully';
+    } '... foo_weak wrote successfully';
     is($foo->foo_weak(), $test, '... got the correct set value');
 
     ok(isweak($foo->{foo_weak}), '... it is a weak reference');
@@ -156,14 +156,14 @@ use Scalar::Util 'isweak';
     can_ok( $foo, 'foo_deref');
     is_deeply( [$foo->foo_deref()], [], '... default default value');
     my @list;
-    ok ! exception {
+    lives_ok {
         @list = $foo->foo_deref();
-    }, "... doesn't deref undef value";
+    } "... doesn't deref undef value";
     is_deeply( \@list, [], "returns empty list in list context");
 
-    ok ! exception {
+    lives_ok {
         $foo->foo_deref( [ qw/foo bar gorch/ ] );
-    }, '... foo_deref wrote successfully';
+    } '... foo_deref wrote successfully';
 
     is( Scalar::Util::reftype( scalar $foo->foo_deref() ), "ARRAY", "returns an array reference in scalar context" );
     is_deeply( scalar($foo->foo_deref()), [ qw/foo bar gorch/ ], "correct array" );
@@ -175,9 +175,9 @@ use Scalar::Util 'isweak';
     can_ok( $foo, 'foo_deref' );
     is_deeply( [$foo->foo_deref_ro()], [], "... default default value" );
 
-    ok exception {
+    dies_ok {
         $foo->foo_deref_ro( [] );
-    }, "... read only";
+    } "... read only";
 
     $foo->{foo_deref_ro} = [qw/la la la/];
 
@@ -188,14 +188,14 @@ use Scalar::Util 'isweak';
     is_deeply( { $foo->foo_deref_hash() }, {}, "... default default value" );
 
     my %hash;
-    ok ! exception {
+    lives_ok {
         %hash = $foo->foo_deref_hash();
-    }, "... doesn't deref undef value";
+    } "... doesn't deref undef value";
     is_deeply( \%hash, {}, "returns empty list in list context");
 
-    ok ! exception {
+    lives_ok {
         $foo->foo_deref_hash( { foo => 1, bar => 2 } );
-    }, '... foo_deref_hash wrote successfully';
+    } '... foo_deref_hash wrote successfully';
 
     is_deeply( scalar($foo->foo_deref_hash), { foo => 1, bar => 2 }, "scalar context" );