4 use warnings FATAL => 'all';
6 use Scalar::Util qw( reftype );
7 use Test::More tests => 12;
9 use t::common qw( new_fh );
11 use_ok( 'DBM::Deep' );
13 # This is bug #34819, reported by EJS
15 my ($fh, $filename) = new_fh();
16 my $db = DBM::Deep->new(
21 my $bar = bless { foo => 'ope' }, 'Foo';
25 warn "$db->{bar}: $bar\n";
29 ok(!$@, "repeated object assignment");
30 isa_ok($db->{bar}, 'Foo');
33 # This is bug #29957, reported by HANENKAMP
35 todo_skip "This crashes the code", 4;
36 my ($fh, $filename) = new_fh();
37 my $db = DBM::Deep->new(
44 for my $value ( 1 .. 3 ) {
52 # This is bug #33863, reported by PJS
54 my ($fh, $filename) = new_fh();
55 my $db = DBM::Deep->new(
61 my $foo = shift @{ $db->{foo} };
62 cmp_ok( @{ $db->{foo} }, '==', 0, "Shifting a scalar leaves no values" );
63 cmp_ok( $foo, '==', 42, "... And the value is correct." );
65 # $db->{bar} = [ [] ];
66 # my $bar = shift @{ $db->{bar} };
67 # cmp_ok( @{ $db->{bar} }, '==', 0, "Shifting an arrayref leaves no values" );
68 # use Data::Dumper; warn Dumper $bar;
70 $db->{baz} = { foo => [ 1 .. 3 ] };
71 $db->{baz2} = [ $db->{baz} ];
72 my $baz2 = shift @{ $db->{baz2} };
73 cmp_ok( @{ $db->{baz2} }, '==', 0, "Shifting an arrayref leaves no values" );
74 ok( exists $db->{baz}{foo} );
75 ok( exists $baz2->{foo} );