# DBM::Deep Test
##
use strict;
-use Test::More tests => 5;
+use Test::More tests => 15;
use_ok( 'DBM::Deep' );
##
$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";
##
##
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' );