X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Ferror.t;h=d5980eb361c552cebbed63caf96a1796bd2983d3;hb=e327f12657df75fbc8d771b4b8d4495cf1dcbd79;hp=d3b28aa3945e9896cab5cdecff6520c32def7462;hpb=b720efd16eb1e747c3d12697f57edb708f67280a;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/error.t b/t/storage/error.t index d3b28aa..d5980eb 100644 --- a/t/storage/error.t +++ b/t/storage/error.t @@ -6,19 +6,16 @@ use Test::Warn; use Test::Exception; use lib qw(t/lib); -use_ok( 'DBICTest' ); -use_ok( 'DBICTest::Schema' ); +use DBICTest; my $schema = DBICTest->init_schema; -my $e_start = quotemeta('DBIx::Class::'); - warnings_are ( sub { throws_ok ( sub { $schema->resultset('CD')->create({ title => 'vacation in antarctica' }) }, - qr/$e_start.+constraint failed.+NULL/s + qr/DBI Exception.+cd\.artist.+NULL/s ); # as opposed to some other error }, [], 'No warnings besides exception' ); @@ -28,25 +25,25 @@ throws_ok ( sub { $dbh->do ('INSERT INTO nonexistent_table VALUES (1)') }, - qr/$e_start.+DBI Exception.+no such table/, + qr/DBI Exception.+no such table.+nonexistent_table/s, 'DBI exceptions properly handled by dbic-installed callback' ); +# This usage is a bit unusual but it was actually seen in the wild # destruction of everything except the $dbh should use the proper # exception fallback: -# FIXME -# These explicit disconnections on loss of $storage don't seem -# right... disable it here for the test anyway -{ - local $dbh->{Callbacks}{disconnect} = sub { 1 }; +SKIP: { + if (DBIx::Class::_ENV_::PEEPEENESS) { + skip "Your perl version $] appears to leak like a sieve - skipping garbage collected \$schema test", 1; + } undef ($schema); throws_ok ( sub { $dbh->do ('INSERT INTO nonexistent_table VALUES (1)') }, - qr/DBI Exception.+unhandled by DBIC.+no such table/, + qr/DBI Exception.+unhandled by DBIC.+no such table.+nonexistent_table/s, 'callback works after $schema is gone' ); }