Initial code written for transactional isolation
[dbsrgits/DBM-Deep.git] / t / 33_transactions.t
index c07bb9d..2b43f68 100644 (file)
@@ -1,5 +1,5 @@
 use strict;
-use Test::More tests => 62;
+use Test::More tests => 65;
 use Test::Deep;
 use t::common qw( new_fh );
 
@@ -22,8 +22,17 @@ $db1->{x} = 'y';
 is( $db1->{x}, 'y', "Before transaction, DB1's X is Y" );
 is( $db2->{x}, 'y', "Before transaction, DB2's X is Y" );
 
+eval { $db1->rollback };
+ok( $@, "Attempting to rollback without a transaction throws an error" );
+
+eval { $db1->commit };
+ok( $@, "Attempting to commit without a transaction throws an error" );
+
 $db1->begin_work;
 
+eval { $db1->begin_work };
+ok( $@, "Attempting to begin_work within a transaction throws an error" );
+
     is( $db1->{x}, 'y', "DB1 transaction started, no actions - DB1's X is Y" );
     is( $db2->{x}, 'y', "DB1 transaction started, no actions - DB2's X is Y" );