Removed error/clear_error functions
[dbsrgits/DBM-Deep.git] / t / 19_crossref.t
1 ##
2 # DBM::Deep Test
3 ##
4 use strict;
5 use Test::More tests => 5;
6
7 use_ok( 'DBM::Deep' );
8
9 unlink "t/test.db";
10 my $db = DBM::Deep->new( "t/test.db" );
11
12 unlink "t/test2.db";
13 my $db2 = DBM::Deep->new( "t/test2.db" );
14
15 ##
16 # Create structure in $db
17 ##
18 $db->import(
19         hash1 => {
20                 subkey1 => "subvalue1",
21                 subkey2 => "subvalue2"
22         }
23 );
24
25 is( $db->{hash1}{subkey1}, 'subvalue1', "Value imported correctly" );
26 is( $db->{hash1}{subkey2}, 'subvalue2', "Value imported correctly" );
27
28 ##
29 # Cross-ref nested hash accross DB objects
30 ##
31 $db2->{copy} = $db->{hash1};
32
33 ##
34 # close, delete $db
35 ##
36 undef $db;
37 unlink "t/test.db";
38
39 ##
40 # Make sure $db2 has copy of $db's hash structure
41 ##
42 is( $db2->{copy}{subkey1}, 'subvalue1', "Value copied correctly" );
43 is( $db2->{copy}{subkey2}, 'subvalue2', "Value copied correctly" );