Commit | Line | Data |
edd45134 |
1 | use 5.006; |
2 | |
3 | use strict; |
4 | use warnings FATAL => 'all'; |
5 | |
40df5605 |
6 | use Test::More tests => 2; |
edd45134 |
7 | use Test::Deep; |
8 | |
9 | use t::common qw( new_fh ); |
10 | |
11 | use_ok( 'DBM::Deep' ); |
12 | |
13 | { |
14 | my ($fh, $filename) = t::common::new_fh(); |
33d7395d |
15 | my $db = DBM::Deep->new( $filename ); |
edd45134 |
16 | |
17 | # Add a self-referencing connection to test export |
18 | my %struct = ( |
19 | key1 => "value1", |
20 | key2 => "value2", |
21 | array1 => [ "elem0", "elem1", "elem2", { foo => 'bar' }, [ 5 ], bless( [], 'Apple' ) ], |
22 | hash1 => { |
23 | subkey1 => "subvalue1", |
24 | subkey2 => "subvalue2", |
25 | subkey3 => bless( { |
26 | sub_obj => bless([ |
27 | bless([], 'Foo'), |
28 | ], 'Foo'), |
29 | sub_obj3 => bless([],'Foo'), |
30 | }, 'Foo' ), |
31 | }, |
32 | ); |
33 | |
34 | $db->{foo} = \%struct; |
35 | |
36 | my $x = delete $db->{foo}; |
37 | |
38 | cmp_deeply( |
39 | $x, |
40 | { |
41 | key1 => "value1", |
42 | key2 => "value2", |
43 | array1 => [ "elem0", "elem1", "elem2", { foo => 'bar' }, [ 5 ], bless( [], 'Apple' ) ], |
44 | hash1 => { |
45 | subkey1 => "subvalue1", |
46 | subkey2 => "subvalue2", |
47 | subkey3 => bless( { |
48 | sub_obj => bless([ |
49 | bless([], 'Foo'), |
50 | ], 'Foo'), |
51 | sub_obj3 => bless([],'Foo'), |
52 | }, 'Foo' ), |
53 | }, |
54 | }, |
55 | "Everything matches", |
56 | ); |
57 | } |
58 | |
59 | __END__ |