# DBM::Deep Test
##
use strict;
-use Test::More tests => 125;
+use Test::More tests => 128;
use Test::Exception;
use t::common qw( new_fh );
my ($fh, $filename) = new_fh();
my $db = DBM::Deep->new(
- file => $filename,
- type => DBM::Deep->TYPE_ARRAY
+ file => $filename,
+ fh => $fh,
+ type => DBM::Deep->TYPE_ARRAY
);
##
throws_ok {
$db->[-6] = 'whoops!';
-} qr/Modification of non-creatable array value attempted, subscript -6/, "Correct error thrown";
+} qr/Modification of non-creatable array value attempted, subscript -6/,
+ "Correct error thrown when attempting to modify a non-creatable array value";
my $popped = $db->pop;
is( $db->length, 4, "... and we have four after popping" );
is($db->[1], "elem last");
is($returned[0], "middle ABC");
+@returned = $db->splice;
+is( $db->length, 0 );
+is( $returned[0], "elem first" );
+is( $returned[1], "elem last" );
+
$db->[0] = [ 1 .. 3 ];
$db->[1] = { a => 'foo' };
is( $db->[0]->length, 3, "Reuse of same space with array successful" );
my ($fh, $filename) = new_fh();
my $db = DBM::Deep->new(
file => $filename,
+ fh => $fh,
type => DBM::Deep->TYPE_ARRAY
);