-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2dc6424
commit 1a2992b
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use Test::More; | ||
|
||
BEGIN { | ||
plan skip_all => "Perl 5.10 is required" unless eval { require 5.010 }; | ||
} | ||
|
||
use ok "Try::Tiny"; | ||
|
||
my ( $error, $topic ); | ||
|
||
given ("foo") { | ||
when (qr/./) { | ||
try { | ||
die "blah\n"; | ||
} catch { | ||
$topic = $_; | ||
$error = $_[0]; | ||
} | ||
}; | ||
} | ||
|
||
is( $error, "blah\n", "error caught" ); | ||
|
||
{ | ||
local $TODO = "perhaps a workaround can be found"; | ||
is( $topic, $error, 'error is also in $_' ); | ||
} | ||
|
||
done_testing; | ||
|
||
# ex: set sw=4 et: | ||
|