Commit | Line | Data |
415dcbb7 |
1 | use strict; |
7a960a12 |
2 | use Test::More tests => 7; |
415dcbb7 |
3 | use Test::Deep; |
4 | use t::common qw( new_fh ); |
5 | |
6 | use_ok( 'DBM::Deep' ); |
7 | |
8 | my ($fh, $filename) = new_fh(); |
a67c4bbf |
9 | my $db = DBM::Deep->new( |
415dcbb7 |
10 | file => $filename, |
11 | locking => 1, |
12 | autoflush => 1, |
36d630c6 |
13 | num_txns => 16, |
415dcbb7 |
14 | ); |
15 | |
a67c4bbf |
16 | my $outer = { a => 'b' }; |
17 | my $inner = { a => 'c' }; |
7a960a12 |
18 | |
a67c4bbf |
19 | $db->{x} = $outer; |
20 | is( $db->{x}{a}, 'b', "BEFORE: We're looking at the right value from outer" ); |
7a960a12 |
21 | |
a67c4bbf |
22 | $db->begin_work; |
415dcbb7 |
23 | |
a67c4bbf |
24 | $db->{x} = $inner; |
25 | is( $db->{x}{a}, 'c', "WITHIN: We're looking at the right value from inner" ); |
fb451ba6 |
26 | TODO: { |
27 | local $TODO = "Transactions not done yet"; |
a67c4bbf |
28 | is( $outer->{a}, 'b', "WITHIN: We're looking at the right value from outer" ); |
fb451ba6 |
29 | } |
415dcbb7 |
30 | |
a67c4bbf |
31 | $db->commit; |
415dcbb7 |
32 | |
a67c4bbf |
33 | is( $db->{x}{a}, 'c', "AFTER: Commit means inner is still correct" ); |
fb451ba6 |
34 | TODO: { |
35 | local $TODO = "Transactions not done yet"; |
a67c4bbf |
36 | is( $outer->{a}, undef, "AFTER: outer made the move" ); |
fb451ba6 |
37 | } |
a67c4bbf |
38 | is( $inner->{a}, 'c', "AFTER: inner made the move" ); |