5 use Test::More tests => 7;
7 use t::common qw( new_fh );
12 my ($fh, $filename) = new_fh();
13 print $fh "Not a DBM::Deep file";
15 my $old_fh = select $fh;
16 my $old_af = $|; $| = 1; $| = $old_af;
20 my $db = DBM::Deep->new( $filename );
21 } qr/^DBM::Deep: Signature not found -- file is not a Deep DB/, "Only DBM::Deep DB files will be opened";
24 my ($fh, $filename) = new_fh();
25 my $db = DBM::Deep->new( $filename );
27 $db->{key1} = "value1";
28 is( $db->{key1}, "value1", "Value set correctly" );
30 # Testing to verify that the close() will occur if open is called on an open DB.
31 #XXX WOW is this hacky ...
32 $db->_get_self->_engine->storage->open;
33 is( $db->{key1}, "value1", "Value still set after re-open" );
36 my $db = DBM::Deep->new( 't' );
37 } qr/^DBM::Deep: Cannot sysopen file 't': /, "Can't open a file we aren't allowed to touch";
40 my $db = DBM::Deep->new(
44 $db->_get_self->_engine->storage->close( $db->_get_self );
45 ok( !$db->lock, "Calling lock() on a closed database returns false" );
49 my $db = DBM::Deep->new(
54 $db->_get_self->_engine->storage->close( $db->_get_self );
55 ok( !$db->unlock, "Calling unlock() on a closed database returns false" );