# DBM::Deep Test
##
use strict;
-use Test::More tests => 4;
+use Test::More tests => 5;
use_ok( 'DBM::Deep' );
# cause an error
##
eval { $db->push("foo"); }; # ERROR -- array-only method
-
ok( $db->error() );
+##
+# make sure you can clear the error state
+##
$db->clear_error();
-
ok( !$db->error() );
undef $db;
+##
+# test a corrupted file
+##
open FH, '>t/test.db';
print FH 'DPDB';
close FH;
-$db = DBM::Deep->new( "t/test.db" );
-TODO: {
- local $TODO = "The return value from load_tag() isn't checked in open()";
- ok( $db->error() );
-}
+eval { $db = DBM::Deep->new( "t/test.db" ); };
+ok( $@ );
+
+##
+# test a file type mismatch
+##
+unlink "t/test.db";
+my %hash;
+tie %hash, 'DBM::Deep', 't/test.db';
+$hash{'foo'} = 'bar';
+undef %hash;
+my @array;
+eval { tie @array, 'DBM::Deep', 't/test.db'; };
+ok( $@ );