[Bast-commits] r9436 - DBIx-Class/0.08/branches/try-tiny/t/inflate
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Tue May 25 18:32:39 GMT 2010
Author: caelum
Date: 2010-05-25 19:32:39 +0100 (Tue, 25 May 2010)
New Revision: 9436
Modified:
DBIx-Class/0.08/branches/try-tiny/t/inflate/datetime_sybase_asa.t
Log:
fix hang in SQLAnywhere DateTime tests
Modified: DBIx-Class/0.08/branches/try-tiny/t/inflate/datetime_sybase_asa.t
===================================================================
--- DBIx-Class/0.08/branches/try-tiny/t/inflate/datetime_sybase_asa.t 2010-05-25 18:04:09 UTC (rev 9435)
+++ DBIx-Class/0.08/branches/try-tiny/t/inflate/datetime_sybase_asa.t 2010-05-25 18:32:39 UTC (rev 9436)
@@ -3,6 +3,7 @@
use Test::More;
use Test::Exception;
+use Scope::Guard ();
use lib qw(t/lib);
use DBICTest;
@@ -27,20 +28,20 @@
[ $dsn2, $user2, $pass2 ],
);
-my @handles_to_clean;
+my $schema;
foreach my $info (@info) {
my ($dsn, $user, $pass) = @$info;
next unless $dsn;
- my $schema = DBICTest::Schema->clone;
+ $schema = DBICTest::Schema->clone;
$schema->connection($dsn, $user, $pass, {
on_connect_call => [ 'datetime_setup' ],
});
- push @handles_to_clean, $schema->storage->dbh;
+ my $sg = Scope::Guard->new(\&cleanup);
# coltype, col, date
my @dt_types = (
@@ -72,7 +73,7 @@
->search({ trackid => $row->trackid }, { select => [$col] })
->first
);
- is( $row->$col, $dt, 'DateTime roundtrip' );
+ is( $row->$col, $dt, "$type roundtrip" );
is $row->$col->nanosecond, $dt->nanosecond,
'nanoseconds survived' if 0+$dt->nanosecond;
@@ -82,8 +83,8 @@
done_testing;
# clean up our mess
-END {
- foreach my $dbh (@handles_to_clean) {
+sub cleanup {
+ if (my $dbh = $schema->storage->dbh) {
eval { $dbh->do("DROP TABLE $_") } for qw/track/;
}
}
More information about the Bast-commits
mailing list