summaryrefslogtreecommitdiffstats
path: root/t/try/given_when.t
diff options
context:
space:
mode:
Diffstat (limited to 't/try/given_when.t')
-rw-r--r--t/try/given_when.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/try/given_when.t b/t/try/given_when.t
new file mode 100644
index 0000000..48d006d
--- /dev/null
+++ b/t/try/given_when.t
@@ -0,0 +1,31 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use lib 't/try/lib';
+use 5.014;
+
+use Try;
+
+my ( $error, $topic );
+
+given ("foo") {
+ when (qr/./) {
+ try {
+ die "blah\n";
+ } catch {
+ $topic = $_;
+ $error = $_[0];
+ }
+ pass("syntax ok");
+ };
+}
+
+is( $error, "blah\n", "error caught" );
+
+{
+ local $TODO = "perhaps a workaround can be found";
+ is( $topic, $error, 'error is also in $_' );
+}
+
+done_testing;