Moved _create_tag, _load_tag, and _index_lookup into the engine
[dbsrgits/DBM-Deep.git] / t / 08_deephash.t
index 288bb0f..6e349d8 100644 (file)
@@ -6,17 +6,14 @@ use Test::More;
 
 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
@@ -45,12 +42,16 @@ undef $temp_db;
 
 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" );