Permalink
Browse files

bring the live SQLite svp test into t/svp_live.t

  • Loading branch information...
1 parent 68ed0f2 commit 7b8da10d9541bde19cff8034907bb7ae23c9c8fb @rjbs rjbs committed Feb 14, 2012
Showing with 0 additions and 54 deletions.
  1. +0 −54 misc/sqlite-svp.t
View
@@ -1,54 +0,0 @@
-use strict;
-use warnings;
-use Test::More tests => 4;
-
-use DBIx::Connector;
-use Scalar::Util qw(blessed);
-
-unlink 'test.sqlite';
-
-my $conn = DBIx::Connector->new(
- 'dbi:SQLite:test.sqlite',
- undef,
- undef,
- { RaiseError => 1 },
-);
-
-$conn->txn(sub {
- my ($dbh) = @_;
- $dbh->do("CREATE TABLE stuff (foo NOT NULL);");
-});
-
-$conn->txn(fixup => sub {
- my ($dbh) = @_;
- $dbh->do("INSERT INTO stuff (foo) VALUES (1);");
-
- my $token = \do { my $x };
-
- my $ok = eval {
- $conn->svp(sub {
- my ($dbh) = @_;
- $dbh->do("INSERT INTO stuff (foo) VALUES (2)");
- die $token;
- });
- 1;
- };
- my $error = $@;
-
- ok( ! $ok, "we didn't survive our svp");
- ok(
- (ref $error && ! blessed $error && $error == $token),
- "we got the expected error, too"
- ) or diag "got error: $error";
-
- $dbh->do("INSERT INTO stuff (foo) VALUES (3);");
-});
-
-$conn->txn(sub {
- my ($dbh) = @_;
- my $rows = $dbh->selectcol_arrayref("SELECT foo FROM stuff ORDER BY foo");
- is(@$rows, 2, "we inserted 2 rows");
- is_deeply($rows, [ 1, 3 ], "...and they're [1],[3] - 2 was lost in the svp");
-});
-
-done_testing;

0 comments on commit 7b8da10

Please sign in to comment.