5 use Test::More tests => 16;
7 use t::common qw( new_fh );
11 my ($fh, $filename) = new_fh();
12 my $db = DBM::Deep->new( $filename );
21 isa_ok( tied(%hash), 'DBM::Deep::Hash' );
23 is( $db->{hash}{foo}, 1 );
24 is_deeply( $db->{hash}{bar}, [ 1 .. 3 ] );
25 is_deeply( $db->{hash}{baz}, { a => 42 } );
28 is( $db->{hash}{foo}, 2 );
31 is( $db->{hash}{bar}[1], 90 );
34 is( $db->{hash}{baz}{b}, 33 );
37 1, [ 1 .. 3 ], { a => 42 },
40 $db->{array} = \@array;
41 isa_ok( tied(@array), 'DBM::Deep::Array' );
43 is( $db->{array}[0], 1 );
44 is_deeply( $db->{array}[1], [ 1 .. 3 ] );
45 is_deeply( $db->{array}[2], { a => 42 } );
48 is( $db->{array}[0], 2 );
51 is( $db->{array}[1][2], 9 );
53 $array[2]{b} = 'floober';
54 is( $db->{array}[2]{b}, 'floober' );
56 my %hash2 = ( abc => [ 1 .. 3 ] );
58 $hash2{ def } = \%hash;
60 is( $array[3]{def}{foo}, 2 );