Commit | Line | Data |
ffed8b01 |
1 | ## |
2 | # DBM::Deep Test |
3 | ## |
4 | use strict; |
5 | use Test::More tests => 14; |
6 | |
7 | use_ok( 'DBM::Deep' ); |
8 | |
9 | unlink "t/test.db"; |
10 | my $db = DBM::Deep->new( |
11 | file => "t/test.db", |
12 | ); |
13 | if ($db->error()) { |
14 | die "ERROR: " . $db->error(); |
15 | } |
16 | |
17 | $db->{key1} = "value1"; |
18 | |
19 | ## |
20 | # clone db handle, make sure both are usable |
21 | ## |
22 | my $clone = $db->clone(); |
23 | |
24 | is($clone->{key1}, "value1"); |
25 | |
26 | $clone->{key2} = "value2"; |
27 | $db->{key3} = "value3"; |
28 | |
29 | is($db->{key1}, "value1"); |
30 | is($db->{key2}, "value2"); |
31 | is($db->{key3}, "value3"); |
32 | |
33 | is($clone->{key1}, "value1"); |
34 | is($clone->{key2}, "value2"); |
35 | is($clone->{key3}, "value3"); |
36 | |
ffed8b01 |
37 | undef $db; |
38 | |
39 | is($clone->{key1}, "value1"); |
40 | is($clone->{key2}, "value2"); |
41 | is($clone->{key3}, "value3"); |
42 | |
43 | undef $clone; |
44 | |
45 | $db = DBM::Deep->new( |
46 | file => "t/test.db", |
47 | ); |
48 | |
49 | is($db->{key1}, "value1"); |
50 | is($db->{key2}, "value2"); |
51 | is($db->{key3}, "value3"); |