Commit | Line | Data |
0ca3a874 |
1 | BEGIN { |
2 | chdir 't' if -d 't'; |
3 | @INC = '../lib'; |
4 | push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS'; |
5 | require Config; import Config; |
6 | if ($Config{'extensions'} !~ /\bXS\/APItest\b/) { |
7 | print "1..0 # Skip: XS::APItest was not built\n"; |
8 | exit 0; |
9 | } |
10 | } |
11 | |
ef469b03 |
12 | use Test::More tests => 9; |
0ca3a874 |
13 | |
14 | BEGIN { use_ok('XS::APItest') }; |
15 | |
16 | ######################### |
17 | |
18 | my $rv; |
19 | |
20 | $XS::APItest::exception_caught = undef; |
21 | |
22 | $rv = eval { exception(0) }; |
23 | is($@, ''); |
24 | ok(defined $rv); |
25 | is($rv, 42); |
26 | is($XS::APItest::exception_caught, 0); |
27 | |
28 | $XS::APItest::exception_caught = undef; |
29 | |
30 | $rv = eval { exception(1) }; |
31 | is($@, "boo\n"); |
32 | ok(not defined $rv); |
33 | is($XS::APItest::exception_caught, 1); |
ef469b03 |
34 | |
35 | $rv = eval { mycroak("foobar\n") }; |
36 | is($@, "foobar\n", 'croak'); |