From: Konstantin A. Pustovalov Date: Mon, 21 Jan 2013 20:40:58 +0000 (+0400) Subject: Enhance exception action test (no functional changes) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4f29a592f18106f2b06660a1cb82911b0ebc2011;p=dbsrgits%2FDBIx-Class-Historic.git Enhance exception action test (no functional changes) --- diff --git a/AUTHORS b/AUTHORS index 90f3033..83632ef 100644 --- a/AUTHORS +++ b/AUTHORS @@ -112,6 +112,7 @@ kd: Kieren Diment kentnl: Kent Fredric kkane: Kevin L. Kane konobi: Scott McWhirter +lamoz: Konstantin A. Pustovalov Lasse Makholm lejeunerenard: Sean Zellmer littlesavage: Alexey Illarionov diff --git a/t/34exception_action.t b/t/34exception_action.t index 6de03f0..b81e568 100644 --- a/t/34exception_action.t +++ b/t/34exception_action.t @@ -28,8 +28,18 @@ throws_ok { $e->rethrow } isa_ok( $@, 'DBIx::Class::Exception' ); # Now lets rethrow via exception_action -$schema->exception_action(sub { die @_ }); -throws_ok \&$throw, $ex_regex; +{ + my $handler_execution_counter = 0; + + $schema->exception_action(sub { + $handler_execution_counter++; + like $_[0], $ex_regex, "Exception is precisely passed to exception_action"; + die @_ + }); + + throws_ok \&$throw, $ex_regex; + is $handler_execution_counter, 1, "exception_action handler executed exactly once"; +} # # This should have never worked!!!