X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F74mssql.t;fp=t%2F74mssql.t;h=007b9d36965e119d06eabcaee2da87a3ffc56960;hb=b90d7ebab489e4f53ad02bf4acd45fb01d8e549f;hp=172c78dfbb329b2fd76a69a319c58285c561fb24;hpb=a4075c9e07111ffdf39cefb9681c7d0b91a4bfb8;p=dbsrgits%2FDBIx-Class.git diff --git a/t/74mssql.t b/t/74mssql.t index 172c78d..007b9d3 100644 --- a/t/74mssql.t +++ b/t/74mssql.t @@ -18,7 +18,7 @@ my ($dsn, $user, $pass) = @ENV{map { "DBICTEST_MSSQL_${_}" } qw/DSN USER PASS/}; plan skip_all => 'Set $ENV{DBICTEST_MSSQL_DSN}, _USER and _PASS to run this test' unless ($dsn); -my $TESTS = 15; +my $TESTS = 18; plan tests => $TESTS * 2; @@ -145,15 +145,30 @@ SQL $rs->reset; } 'multiple active statements'; - # test multiple active statements in a transaction - TODO: { - local $TODO = 'needs similar FreeTDS fixes to the ones in Sybase.pm'; - lives_ok { - $schema->txn_do(sub { - $rs->create({ amount => 400 }); - }); - } 'simple transaction'; - } + $rs->delete; + + # test simple transaction with commit + lives_ok { + $schema->txn_do(sub { + $rs->create({ amount => 400 }); + }); + } 'simple transaction'; + + cmp_ok $rs->first->amount, '==', 400, 'committed'; + $rs->reset; + + $rs->delete; + + # test rollback + throws_ok { + $schema->txn_do(sub { + $rs->create({ amount => 400 }); + die 'mtfnpy'; + }); + } qr/mtfnpy/, 'simple failed txn'; + + is $rs->first, undef, 'rolled back'; + $rs->reset; } # clean up our mess