Add ARM files
[dh-make-perl] / dev / arm / libtest-simple-perl / libtest-simple-perl-0.80 / t / try.t
1 #!perl -w
2
3 BEGIN {
4     if( $ENV{PERL_CORE} ) {
5         chdir 't';
6         @INC = ('../lib', 'lib');
7     }
8     else {
9         unshift @INC, 't/lib';
10     }
11 }
12
13 use strict;
14
15 use Test::More 'no_plan';
16
17 require Test::Builder;
18 my $tb = Test::Builder->new;
19
20 local $SIG{__DIE__} = sub { fail("DIE handler called: @_") };
21
22 # These should not change;
23 local $@ = 42;
24 local $! = 23;
25
26 is $tb->_try(sub { 2 }), 2;
27 is $tb->_try(sub { return '' }), '';
28
29 is $tb->_try(sub { die; }), undef;
30
31 is_deeply [$tb->_try(sub { die "Foo\n" }, undef)],
32           [undef, "Foo\n"];
33
34 is $@, 42;
35 cmp_ok $!, '==', 23;