Commit | Line | Data |
---|---|---|
1a2992bb | 1 | use strict; |
2 | use warnings; | |
3 | ||
4 | use Test::More; | |
5 | ||
6 | BEGIN { | |
b715d61b | 7 | plan skip_all => 'Perl 5.010 is required' unless "$]" >= '5.010'; |
82559400 | 8 | plan skip_all => 'Tests skipped on perl 5.27.{7,8,9} when smartmatch behaviour changed' if "$]" >= '5.027007' and "$]" < '5.027010'; |
c6d66f74 | 9 | plan tests => 2; |
1a2992bb | 10 | } |
11 | ||
01b96275 | 12 | use Try::Tiny; |
13 | ||
73664e25 | 14 | use 5.010; |
8c34b0ef | 15 | no if "$]" >= 5.017011, warnings => 'experimental::smartmatch'; |
73664e25 | 16 | |
1a2992bb | 17 | my ( $error, $topic ); |
18 | ||
19 | given ("foo") { | |
8d2ee831 | 20 | when (qr/./) { |
21 | try { | |
22 | die "blah\n"; | |
23 | } catch { | |
24 | $topic = $_; | |
25 | $error = $_[0]; | |
26 | } | |
27 | }; | |
1a2992bb | 28 | } |
29 | ||
30 | is( $error, "blah\n", "error caught" ); | |
31 | ||
32 | { | |
aaf0d61f | 33 | local $TODO = "perhaps a workaround can be found" |
8c34b0ef | 34 | if "$]" < 5.017003; |
8d2ee831 | 35 | is( $topic, $error, 'error is also in $_' ); |
1a2992bb | 36 | } |
37 | ||
1a2992bb | 38 | # ex: set sw=4 et: |