2 use Test::More tests => 17;
4 use t::common qw( new_fh );
8 my ($fh, $filename) = new_fh();
9 my $db1 = DBM::Deep->new(
13 type => DBM::Deep->TYPE_ARRAY,
16 my $db2 = DBM::Deep->new(
20 type => DBM::Deep->TYPE_ARRAY,
24 is( $db1->[0], 'y', "Before transaction, DB1's 0 is Y" );
25 is( $db2->[0], 'y', "Before transaction, DB2's 0 is Y" );
29 is( $db1->[0], 'y', "DB1 transaction started, no actions - DB1's 0 is Y" );
30 is( $db2->[0], 'y', "DB1 transaction started, no actions - DB2's 0 is Y" );
33 is( $db1->[0], 'z', "Within DB1 transaction, DB1's 0 is Z" );
34 is( $db2->[0], 'y', "Within DB1 transaction, DB2's 0 is still Y" );
37 is( $db2->[1], 'foo', "DB2 set 1 within DB1's transaction, so DB2 can see it" );
38 ok( !exists $db1->[1], "Since 1 was added after the transaction began, DB1 doesn't see it." );
40 cmp_ok( scalar(@$db1), '==', 1, "DB1 has 1 element" );
41 cmp_ok( scalar(@$db2), '==', 2, "DB2 has 2 elements" );
45 is( $db1->[0], 'y', "After rollback, DB1's 0 is Y" );
46 is( $db2->[0], 'y', "After rollback, DB2's 0 is Y" );
48 is( $db1->[1], 'foo', "After DB1 transaction is over, DB1 can see 1" );
49 is( $db2->[1], 'foo', "After DB1 transaction is over, DB2 can still see 1" );
51 cmp_ok( scalar(@$db1), '==', 2, "DB1 now has 2 elements" );
52 cmp_ok( scalar(@$db2), '==', 2, "DB2 still has 2 elements" );