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