Checked in the failure case for the retying
[dbsrgits/DBM-Deep.git] / t / 19_crossref.t
index 56f96de..339c14c 100644 (file)
@@ -2,7 +2,7 @@
 # DBM::Deep Test
 ##
 use strict;
-use Test::More tests => 5;
+use Test::More tests => 15;
 
 use_ok( 'DBM::Deep' );
 
@@ -36,10 +36,43 @@ is( $db->{hash1}{subkey2}, 'subvalue2', "Value imported correctly" );
 ##
 $db2->{copy} = $db->{hash1};
 
+$db->{hash1}{subkey3} = 'where does this go?';
+is( $db->{hash1}{subkey3}, 'where does this go?' );
+
+$db2->{copy}{subkey4} = 'from the other side';
+is( $db2->{copy}{subkey4}, 'from the other side' );
+
+########
+# This is the failure case
+#
+{
+    my $left = $db->{hash1};
+    $db2->{right} = $left;
+
+    $db2->{right}{rightward} = 'floober';
+    is( $db2->{right}{rightward}, 'floober' );
+    isnt( $db->{hash1}{rightward}, 'floober' );
+}
+#
+#
+########
+
 ##
 # close, delete $db
 ##
 undef $db;
+
+{
+    my $db3 = DBM::Deep->new( 't/test.db' );
+    if ($db3->error()) {
+        die "ERROR: " . $db3->error();
+    }
+    is( $db3->{hash1}{subkey1}, 'subvalue1' );
+    is( $db3->{hash1}{subkey2}, 'subvalue2' );
+    is( $db3->{hash1}{subkey3}, 'where does this go?' );
+    isnt( $db3->{hash1}{subkey4}, 'from the other side' );
+}
+
 unlink "t/test.db";
 
 ##
@@ -47,3 +80,5 @@ unlink "t/test.db";
 ##
 is( $db2->{copy}{subkey1}, 'subvalue1', "Value copied correctly" );
 is( $db2->{copy}{subkey2}, 'subvalue2', "Value copied correctly" );
+isnt( $db2->{copy}{subkey3}, 'where does this go?' );
+is( $db2->{copy}{subkey4}, 'from the other side' );