# DBM::Deep Test
##
use strict;
-use Test::More tests => 30;
+use Test::More tests => 32;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
use Fcntl qw( :flock );
($first_key ne $next_key)
,"keys() still works if you replace long values with shorter ones"
);
+
+# Test autovivification
+
+$db->{unknown}{bar} = 1;
+ok( $db->{unknown} );
+cmp_ok( $db->{unknown}{bar}, '==', 1 );
# DBM::Deep Test
##
use strict;
-use Test::More tests => 107;
+use Test::More tests => 109;
use Test::Exception;
use File::Temp qw( tempfile tempdir );
use Fcntl qw( :flock );
$db->[1] = { a => 'foo' };
is( $db->[1]->fetch('a'), 'foo', "Reuse of same space with hash successful" );
is( $db->[0]->length, 3, "Reuse of same space with array successful" );
+
+# Test autovivification
+
+$db->[9999]{bar} = 1;
+ok( $db->[9999] );
+cmp_ok( $db->[9999]{bar}, '==', 1 );