new config option to DBICTest to let you set an alternative storage type, start on...
[dbsrgits/DBIx-Class.git] / t / 34exception_action.t
index dd54be1..8fd70ba 100644 (file)
@@ -5,7 +5,7 @@ use Test::More;
 use lib qw(t/lib);
 use DBICTest;
 
-plan tests => 6;
+plan tests => 8;
 
 # Set up the "usual" sqlite for DBICTest
 my $schema = DBICTest->init_schema;
@@ -19,6 +19,12 @@ my $ex_regex = qr/Odd number of arguments to search/;
 
 # Basic check, normal exception
 eval { throwex };
+my $e = $@; # like() seems to stringify $@
+like($@, $ex_regex);
+
+# Re-throw the exception with rethrow()
+eval { $e->rethrow };
+isa_ok( $@, 'DBIx::Class::Exception' );
 like($@, $ex_regex);
 
 # Now lets rethrow via exception_action
@@ -60,5 +66,5 @@ eval { throwex };
 like($@, qr/DBICTest::Exception is handling this: $ex_regex/);
 
 # While we're at it, lets throw a custom exception through Storage::DBI
-eval { DBICTest->schema->storage->throw_exception('floob') };
+eval { $schema->storage->throw_exception('floob') };
 like($@, qr/DBICTest::Exception is handling this: floob/);