All tests pass and/or have been marked as not being run
[dbsrgits/DBM-Deep.git] / t / 53_misc_transactions.t
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
6 use strict;
7 #use warnings FATAL => 'all';
8
9 use Test::More tests => 4;
10 use t::common qw( new_fh );
11
12 use_ok( 'DBM::Deep' );
13
14 my ($fh, $filename) = new_fh();
15 my $db = DBM::Deep->new( file => $filename, fh => $fh, );
16
17 eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures");
18
19 eval {
20     $db->begin_work;
21     $db->{randkey()} = randkey() for 1 .. 10;
22     $db->commit;
23 };
24 ok(!$@, 'No eval failures');
25
26 eval { $db->{randkey()} = randkey() for 1 .. 10; }; ok(!$@, "No eval failures");
27
28 sub randkey {
29     our $i ++;
30     my @k = map { int rand 100 } 1 .. 10;
31     local $" = "-";
32
33     return "$i-@k";
34 }