Move lazy_build processing to its own sub and make it work for inherited attrs
[gitmo/Moose.git] / t / 020_attributes / 013_attr_dereference_test.t
index 903134b..42953be 100644 (file)
@@ -3,12 +3,9 @@
 use strict;
 use warnings;
 
-use Test::More tests => 12;
-use Test::Exception;
+use Test::More;
+use Test::Fatal;
 
-BEGIN {
-    use_ok('Moose');
-}
 
 {
     package Customer;
@@ -18,14 +15,14 @@ BEGIN {
     use Moose;
     use Moose::Util::TypeConstraints;
 
-    ::lives_ok {
+    ::ok ! ::exception {
         has 'customers' => (
             is         => 'ro',
-            isa        => subtype('ArrayRef' => where { 
+            isa        => subtype('ArrayRef' => where {
                             (blessed($_) && $_->isa('Customer') || return) for @$_; 1 }),
             auto_deref => 1,
         );
-    } '... successfully created attr';
+    }, '... successfully created attr';
 }
 
 {
@@ -70,14 +67,16 @@ BEGIN {
 
 {
     my $autoderef = AutoDeref->new;
-    
-    dies_ok {
+
+    ok exception {
         $autoderef->bar(1, 2, 3);
-    } '... its auto-de-ref-ing, not auto-en-ref-ing';
-    
-    lives_ok  { 
-        $autoderef->bar([ 1, 2, 3 ]) 
-    } '... set the results of bar correctly';
+    }, '... its auto-de-ref-ing, not auto-en-ref-ing';
+
+    ok ! exception {
+        $autoderef->bar([ 1, 2, 3 ])
+    }, '... set the results of bar correctly';
 
     is_deeply [ $autoderef->bar ], [ 1, 2, 3 ], '... auto-dereffed correctly';
 }
+
+done_testing;