Converted all relevant tests to use new_dbm instead of new_fh and all tests (except...
[dbsrgits/DBM-Deep.git] / t / 53_misc_transactions.t
index faa90c9..f33ab42 100644 (file)
@@ -1,4 +1,3 @@
-
 # This was discussed here:
 # http://groups.google.com/group/DBM-Deep/browse_thread/thread/a6b8224ffec21bab
 # brought up by Alex Gallichotte
@@ -6,27 +5,31 @@
 use strict;
 use warnings FATAL => 'all';
 
-use Test::More tests => 4;
-use t::common qw( new_fh );
+use Test::More;
+use t::common qw( new_dbm );
 
 use_ok( 'DBM::Deep' );
 
-my ($fh, $filename) = new_fh();
-my $db = DBM::Deep->new( $filename );
+my $dbm_factory = new_dbm();
+while ( my $dbm_maker = $dbm_factory->() ) {
+    my $db = $dbm_maker->();
+    eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures");
 
-eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures");
+    eval {
+        #$db->begin_work;
+        $db->{randkey()} = randkey() for 1 .. 10;
+        #$db->commit;
+    };
+    ok(!$@, "No eval failures from the transaction");
 
-eval {
-#    $db->begin_work;
-    $db->{randkey()} = randkey() for 1 .. 10;
-#    $db->commit;
-};
-ok(!$@, "No eval failures from the transaction");
+    eval { $db->{randkey()} = randkey() for 1 .. 10; };
+    ok(!$@, "No eval failures");
+}
 
-eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures");
+done_testing;
 
 sub randkey {
-    our $i ++;
+    our $i++;
     my @k = map { int rand 100 } 1 .. 10;
     local $" = "-";