fix tests failing on 5.6.x due to differing DESTROY semantics
[p5sagit/Try-Tiny.git] / t / given_when.t
CommitLineData
1a2992bb 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6use Test::More;
7
8BEGIN {
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 14use 5.010;
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{
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