X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Fstorage%2Fbase.t;h=2aac70c6564da00704c159a922c2697f1f7c1223;hb=90cfe42b94a798be8ee5498fd57e2e76adff5156;hp=2a4dd6aba7c0daa017c343cfaf1e3805b1a0d6f4;hpb=6b5e61afda80696f56615aa1b66e6f65539c5be0;p=dbsrgits%2FDBIx-Class.git diff --git a/t/storage/base.t b/t/storage/base.t index 2a4dd6a..2aac70c 100644 --- a/t/storage/base.t +++ b/t/storage/base.t @@ -3,6 +3,7 @@ use warnings; use Test::More; use Test::Warn; +use Test::Exception; use lib qw(t/lib); use DBICTest; use Data::Dumper; @@ -42,24 +43,20 @@ is( ref($schema->storage), 'DBIx::Class::Storage::DBI::SQLite', my $storage = $schema->storage; $storage->ensure_connected; -eval { +throws_ok { $schema->storage->throw_exception('test_exception_42'); -}; -like($@, qr/\btest_exception_42\b/, 'basic exception'); +} qr/\btest_exception_42\b/, 'basic exception'; -eval { +throws_ok { $schema->resultset('CD')->search_literal('broken +%$#$1')->all; -}; -like($@, qr/prepare_cached failed/, 'exception via DBI->HandleError, etc'); +} qr/prepare_cached failed/, 'exception via DBI->HandleError, etc'; bless $storage, "DBICTest::ExplodingStorage"; $schema->storage($storage); -eval { +lives_ok { $schema->resultset('Artist')->create({ name => "Exploding Sheep" }); -}; - -is($@, "", "Exploding \$sth->execute was caught"); +} 'Exploding $sth->execute was caught'; is(1, $schema->resultset('Artist')->search({name => "Exploding Sheep" })->count, "And the STH was retired"); @@ -143,6 +140,7 @@ my $invocations = { AutoCommit => 0, }, ], + warn => qr/\QYou provided explicit AutoCommit => 0 in your connection_info/, }, 'connect_info ([ \%attr_with_coderef ])' => { args => [ { @@ -166,8 +164,6 @@ for my $type (keys %$invocations) { local $Data::Dumper::Sortkeys = 1; my $arg_dump = Dumper ($invocations->{$type}{args}); - my $do = sub { }; - warnings_exist ( sub { $storage->connect_info ($invocations->{$type}{args}) }, $invocations->{$type}{warn} || (),