Merge branch 'master' into topic/constructor_rewrite
[dbsrgits/DBIx-Class.git] / t / 33exception_wrap.t
diff --git a/t/33exception_wrap.t b/t/33exception_wrap.t
new file mode 100644 (file)
index 0000000..fdee230
--- /dev/null
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+
+use lib qw(t/lib);
+
+use DBICTest;
+my $schema = DBICTest->init_schema;
+
+throws_ok (sub {
+  $schema->txn_do (sub { die 'lol' } );
+}, 'DBIx::Class::Exception', 'a DBIC::Exception object thrown');
+
+throws_ok (sub {
+  $schema->txn_do (sub { die [qw/lol wut/] });
+}, qr/ARRAY\(0x/, 'An arrayref thrown');
+
+is_deeply (
+  $@,
+  [qw/ lol wut /],
+  'Exception-arrayref contents preserved',
+);
+
+done_testing;