All the tests now pass with the broken out classes
[dbsrgits/DBM-Deep.git] / t / 53_misc_transactions.t
CommitLineData
403f8ed3 1
2# This was discussed here:
3# http://groups.google.com/group/DBM-Deep/browse_thread/thread/a6b8224ffec21bab
4# brought up by Alex Gallichotte
5
6use strict;
f0276afb 7use warnings FATAL => 'all';
09dd8113 8
9use Test::More tests => 4;
403f8ed3 10use t::common qw( new_fh );
11
09dd8113 12use_ok( 'DBM::Deep' );
13
403f8ed3 14my ($fh, $filename) = new_fh();
f0276afb 15my $db = DBM::Deep->new( file => $filename, fh => $fh );
403f8ed3 16
09dd8113 17eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures");
403f8ed3 18
19eval {
f0276afb 20# $db->begin_work;
403f8ed3 21 $db->{randkey()} = randkey() for 1 .. 10;
f0276afb 22# $db->commit;
403f8ed3 23};
f0276afb 24ok(!$@, "No eval failures from the transaction");
403f8ed3 25
09dd8113 26eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures");
403f8ed3 27
28sub randkey {
29 our $i ++;
30 my @k = map { int rand 100 } 1 .. 10;
31 local $" = "-";
32
33 return "$i-@k";
34}