X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F751msaccess.t;h=8d8aa7e8bdc76ec4d20bc91bc6ef09e11f05005d;hb=7664b1a03c8f4da961d1f9795c9af1d545a24ea1;hp=403dc21912d3a41060b6747acf4774ba0b581d4b;hpb=199fbc453ec03891d0e156d7353c5e992ba4de47;p=dbsrgits%2FDBIx-Class.git diff --git a/t/751msaccess.t b/t/751msaccess.t index 403dc21..8d8aa7e 100644 --- a/t/751msaccess.t +++ b/t/751msaccess.t @@ -42,15 +42,13 @@ my @info = ( [ $dsn2, $user2 || '', $pass2 || '' ], ); -my $schema; - foreach my $info (@info) { my ($dsn, $user, $pass) = @$info; next unless $dsn; # Check that we can connect without any options. - $schema = DBICTest::Schema->connect($dsn, $user, $pass); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass); lives_ok { $schema->storage->ensure_connected; } 'connection without any options'; @@ -66,7 +64,7 @@ foreach my $info (@info) { LongReadLen => $maxloblen, }); - my $guard = Scope::Guard->new(\&cleanup); + my $guard = Scope::Guard->new(sub { cleanup($schema) }); my $dbh = $schema->storage->dbh; @@ -166,6 +164,8 @@ EOF s/^'//, s/'\z// for @bind; + # test is duplicated in t/sqlmaker/msaccess.t, keep a duplicate here anyway, just to be safe + # -- ribasushi is_same_sql_bind( $sql, \@bind, @@ -197,6 +197,8 @@ EOF s/^'//, s/'\z// for @bind; + # test is duplicated in t/sqlmaker/msaccess.t, keep a duplicate here anyway, just to be safe + # -- ribasushi is_same_sql_bind( $sql, \@bind, @@ -442,6 +444,8 @@ SQL done_testing; sub cleanup { + my $schema = shift; + if (my $storage = eval { $schema->storage }) { # cannot drop a table if it has been used, have to reconnect first $schema->storage->disconnect;