Merged with master and am ready to merge back
[dbsrgits/DBM-Deep.git] / t / 21_tie_access.t
index 29a5ef6..faeaa2f 100644 (file)
@@ -1,8 +1,7 @@
-##
-# DBM::Deep Test
-##
 use strict;
-use Test::More tests => 7;
+use warnings FATAL => 'all';
+
+use Test::More;
 use Test::Exception;
 use t::common qw( new_fh );
 
@@ -16,6 +15,7 @@ my ($fh, $filename) = new_fh();
 
     $hash{key1} = 'value';
     is( $hash{key1}, 'value', 'Set and retrieved key1' );
+    tied( %hash )->_get_self->_engine->storage->close( tied( %hash )->_get_self );
 }
 
 {
@@ -26,6 +26,7 @@ my ($fh, $filename) = new_fh();
 
     is( keys %hash, 1, "There's one key so far" );
     ok( exists $hash{key1}, "... and it's key1" );
+    tied( %hash )->_get_self->_engine->storage->close( tied( %hash )->_get_self );
 }
 
 {
@@ -34,12 +35,13 @@ my ($fh, $filename) = new_fh();
             file => $filename,
             type => DBM::Deep->TYPE_ARRAY,
         };
+        tied( @array )->_get_self->_engine->storage->close( tied( @array )->_get_self );
     } qr/DBM::Deep: File type mismatch/, "\$SIG_TYPE doesn't match file's type";
 }
 
 {
     my ($fh, $filename) = new_fh();
-    DBM::Deep->new( file => $filename, type => DBM::Deep->TYPE_ARRAY );
+    my $db = DBM::Deep->new( file => $filename, type => DBM::Deep->TYPE_ARRAY );
 
     throws_ok {
         tie my %hash, 'DBM::Deep', {
@@ -47,4 +49,7 @@ my ($fh, $filename) = new_fh();
             type => DBM::Deep->TYPE_HASH,
         };
     } qr/DBM::Deep: File type mismatch/, "\$SIG_TYPE doesn't match file's type";
+    $db->_get_self->_engine->storage->close( $db->_get_self );
 }
+
+done_testing;