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