X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F33exception_wrap.t;h=3b351ab9d4b09348c55c94c2ef1fc29099adda66;hb=35cf7d1af;hp=fdee2305302b4ead58d256feaaf61d69fa3de163;hpb=c6d30d5e0e80fb465dc71e0f20de176f35b4261f;p=dbsrgits%2FDBIx-Class.git diff --git a/t/33exception_wrap.t b/t/33exception_wrap.t index fdee230..3b351ab 100644 --- a/t/33exception_wrap.t +++ b/t/33exception_wrap.t @@ -3,6 +3,7 @@ use warnings; use Test::More; use Test::Exception; +use Test::Warn; use lib qw(t/lib); @@ -23,4 +24,29 @@ is_deeply ( 'Exception-arrayref contents preserved', ); +for my $ap (qw( + DBICTest::AntiPattern::TrueZeroLen + DBICTest::AntiPattern::NullObject +)) { + eval "require $ap"; + + warnings_like { + eval { + $schema->txn_do (sub { die $ap->new }); + }; + + isa_ok $@, $ap; + } qr/\QObjects of external exception class '$ap' stringify to '' (the empty string)/, + 'Proper warning on encountered antipattern'; + + warnings_are { + $@ = $ap->new; + $schema->txn_do (sub { 1 }); + + $@ = $ap->new; + $schema->txn_scope_guard->commit; + } [], 'No spurious PSA warnings on pre-existing antipatterns in $@'; + +} + done_testing;