3 use Test::More tests => 16;
5 use t::common qw( new_fh );
9 my ($fh, $filename) = new_fh();
10 my $db = DBM::Deep->new( $filename );
19 isa_ok( tied(%hash), 'DBM::Deep::Hash' );
21 is( $db->{hash}{foo}, 1 );
22 is_deeply( $db->{hash}{bar}, [ 1 .. 3 ] );
23 is_deeply( $db->{hash}{baz}, { a => 42 } );
26 is( $db->{hash}{foo}, 2 );
29 is( $db->{hash}{bar}[1], 90 );
32 is( $db->{hash}{baz}{b}, 33 );
35 1, [ 1 .. 3 ], { a => 42 },
38 $db->{array} = \@array;
39 isa_ok( tied(@array), 'DBM::Deep::Array' );
41 is( $db->{array}[0], 1 );
42 is_deeply( $db->{array}[1], [ 1 .. 3 ] );
43 is_deeply( $db->{array}[2], { a => 42 } );
46 is( $db->{array}[0], 2 );
49 is( $db->{array}[1][2], 9 );
51 $array[2]{b} = 'floober';
52 is( $db->{array}[2]{b}, 'floober' );
54 my %hash2 = ( abc => [ 1 .. 3 ] );
57 $hash2{ def } = \%hash;
58 is( $array[3]{def}{foo}, 2 );