r11693@rob-kinyons-powerbook58: rob | 2006-04-30 22:15:38 -0400
[dbsrgits/DBM-Deep.git] / t / 36_transaction_deep.t
CommitLineData
415dcbb7 1use strict;
7a960a12 2use Test::More tests => 7;
415dcbb7 3use Test::Deep;
4use t::common qw( new_fh );
5
6use_ok( 'DBM::Deep' );
7
8my ($fh, $filename) = new_fh();
9my $db1 = DBM::Deep->new(
10 file => $filename,
11 locking => 1,
12 autoflush => 1,
13);
14
7a960a12 15my $x_outer = { a => 'b' };
16my $x_inner = { a => 'c' };;
17
18$db1->{x} = $x_outer;
19is( $db1->{x}{a}, 'b', "We're looking at the right value from outer" );
20
415dcbb7 21$db1->begin_work;
22
7a960a12 23 $db1->{x} = $x_inner;
24 is( $db1->{x}{a}, 'c', "We're looking at the right value from inner" );
25 is( $x_outer->{a}, 'c', "We're looking at the right value from outer" );
415dcbb7 26
27$db1->commit;
28
7a960a12 29is( $db1->{x}{a}, 'c', "Commit means x_inner is still correct" );
30is( $x_outer->{a}, 'c', "outer made the move" );
31is( $x_inner->{a}, 'c', "inner is still good" );