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 => 'bar' }, 'Foo';
28 ok(!$@, "repeated object assignment");
29 isa_ok($db->{bar}, 'Foo');
32 # This is bug #29957, reported by HANENKAMP
34 todo_skip "This crashes the code", 4;
35 my ($fh, $filename) = new_fh();
36 my $db = DBM::Deep->new(
43 for my $value ( 1 .. 3 ) {
51 # This is bug #33863, reported by PJS
53 my ($fh, $filename) = new_fh();
54 my $db = DBM::Deep->new(
60 my $foo = shift @{ $db->{foo} };
61 cmp_ok( @{ $db->{foo} }, '==', 0, "Shifting a scalar leaves no values" );
62 cmp_ok( $foo, '==', 42, "... And the value is correct." );
64 # $db->{bar} = [ [] ];
65 # my $bar = shift @{ $db->{bar} };
66 # cmp_ok( @{ $db->{bar} }, '==', 0, "Shifting an arrayref leaves no values" );
67 # use Data::Dumper; warn Dumper $bar;
69 $db->{baz} = { foo => [ 1 .. 3 ] };
70 $db->{baz2} = [ $db->{baz} ];
71 my $baz2 = shift @{ $db->{baz2} };
72 cmp_ok( @{ $db->{baz2} }, '==', 0, "Shifting an arrayref leaves no values" );
73 ok( exists $db->{baz}{foo} );
74 ok( exists $baz2->{foo} );