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