Commit | Line | Data |
---|---|---|
1a2992bb | 1 | #!/usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use Test::More; | |
7 | ||
8 | BEGIN { | |
8d2ee831 | 9 | plan skip_all => "Perl 5.10 is required" unless eval { require 5.010 }; |
10 | plan tests => 3; | |
11 | use_ok("Try::Tiny"); | |
1a2992bb | 12 | } |
13 | ||
73664e25 | 14 | use 5.010; |
15 | ||
1a2992bb | 16 | my ( $error, $topic ); |
17 | ||
18 | given ("foo") { | |
8d2ee831 | 19 | when (qr/./) { |
20 | try { | |
21 | die "blah\n"; | |
22 | } catch { | |
23 | $topic = $_; | |
24 | $error = $_[0]; | |
25 | } | |
26 | }; | |
1a2992bb | 27 | } |
28 | ||
29 | is( $error, "blah\n", "error caught" ); | |
30 | ||
31 | { | |
8d2ee831 | 32 | local $TODO = "perhaps a workaround can be found"; |
33 | is( $topic, $error, 'error is also in $_' ); | |
1a2992bb | 34 | } |
35 | ||
1a2992bb | 36 | # ex: set sw=4 et: |
37 |