diff options
author | Jesse Luehrs <doy@tozt.net> | 2012-08-18 15:08:00 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2012-08-18 16:25:59 -0500 |
commit | 93dd811c1233c3e9d28d92a56166436a81c3e854 (patch) | |
tree | 56710060e64212f37f85a651c5174c3523bd5bb1 /t/given_when.t | |
parent | e590eb7516d6c3533254fb85699473e43ac9c8d8 (diff) | |
download | try-93dd811c1233c3e9d28d92a56166436a81c3e854.tar.gz try-93dd811c1233c3e9d28d92a56166436a81c3e854.zip |
first implementation
Diffstat (limited to 't/given_when.t')
-rw-r--r-- | t/given_when.t | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/t/given_when.t b/t/given_when.t new file mode 100644 index 0000000..3c18e0d --- /dev/null +++ b/t/given_when.t @@ -0,0 +1,30 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More; +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; |