Make sure authors have all the deps
[gitmo/MooseX-Storage.git] / t / 004_w_cycles.t
index 5e03c9a..6dd816e 100644 (file)
@@ -3,8 +3,8 @@
 use strict;
 use warnings;
 
-use Test::More tests => 16;
-use Test::Exception;
+use Test::More tests => 18;
+use Test::Fatal;
 
 BEGIN {
     use_ok('MooseX::Storage');
@@ -37,20 +37,20 @@ This test demonstrates two things:
     
     $circular->cycle($circular);
     
-    throws_ok {
+    like(exception {
         $circular->pack;
-    } qr/^Basic Engine does not support cycles/, 
-    '... cannot collapse a cycle with the basic engine';
+    }, qr/^Basic Engine does not support cycles/,
+    '... cannot collapse a cycle with the basic engine');
 }
 
 {
     my $packed_circular = { __CLASS__ => 'Circular' };
     $packed_circular->{cycle} = $packed_circular;
 
-    throws_ok {
+    like( exception {
         Circular->unpack($packed_circular);
-    } qr/^Basic Engine does not support cycles/, 
-    '... cannot expand a cycle with the basic engine';
+    }, qr/^Basic Engine does not support cycles/,
+    '... cannot expand a cycle with the basic engine');
 }
 
 {
@@ -145,16 +145,17 @@ This test demonstrates two things:
     my $double = Double->new( 'x' => $ref, 'y' => $ref );
 
     ### currently, the cycle checker's too naive to figure out this is not
-    ### a problem
+    ### a problem, pass an empty hashref to the 2nd test to make sure it
+    ### doesn't warn/die
     TODO: {
         local $TODO = "Cycle check is too naive";
         my $pack = eval { $double->pack; };
         ok( $pack,              "Object with 2 references packed" );
-        ok( Double->unpack( $pack ),
+        ok( Double->unpack( $pack || {} ),
                                 "   And unpacked again" );
     }
     
-    my $pack = $double->pack( disable_cycle_check => 1 );
+    my $pack = $double->pack( engine_traits => [qw/DisableCycleDetection/] );
     ok( $pack,                  "   Object packs when cycle check is disabled");
     ok( Double->unpack( $pack ),
                                 "   And unpacked again" );