my $max_levels = 1000;
-plan tests => $max_levels + 5;
+plan tests => 5;
use_ok( 'DBM::Deep' );
unlink "t/test.db";
my $db = DBM::Deep->new(
- file => "t/test.db"
+ file => "t/test.db",
);
-if ($db->error()) {
- die "ERROR: " . $db->error();
-}
##
# basic deep hash
undef $db;
$db = DBM::Deep->new(
- file => "t/test.db"
+ file => "t/test.db",
+ type => DBM::Deep->TYPE_HASH,
);
+my $cur_level = -1;
$temp_db = $db->{base_level};
for my $k ( 0 .. $max_levels ) {
+ $cur_level = $k;
$temp_db = $temp_db->{"level$k"};
- isa_ok( $temp_db, 'DBM::Deep' ) || die "Whoops!";
+ eval { $temp_db->isa( 'DBM::Deep' ) } or last;
}
+is( $cur_level, $max_levels, "We read all the way down to level $cur_level" );
is( $temp_db->{deepkey}, "deepvalue", "And we retrieved the value at the bottom of the ocean" );