bump version on modules changed since 5.13.0
[p5sagit/p5-mst-13.2.git] / ext / XS-APItest / t / exception.t
CommitLineData
0ca3a874 1BEGIN {
0ca3a874 2 push @INC, "::lib:$MacPerl::Architecture:" if $^O eq 'MacOS';
3 require Config; import Config;
4 if ($Config{'extensions'} !~ /\bXS\/APItest\b/) {
5 print "1..0 # Skip: XS::APItest was not built\n";
6 exit 0;
7 }
8}
9
7e7a3dfc 10use Test::More tests => 12;
0ca3a874 11
12BEGIN { use_ok('XS::APItest') };
13
14#########################
15
16my $rv;
17
18$XS::APItest::exception_caught = undef;
19
7a646707 20$rv = eval { apitest_exception(0) };
0ca3a874 21is($@, '');
22ok(defined $rv);
23is($rv, 42);
24is($XS::APItest::exception_caught, 0);
25
26$XS::APItest::exception_caught = undef;
27
7a646707 28$rv = eval { apitest_exception(1) };
0ca3a874 29is($@, "boo\n");
30ok(not defined $rv);
31is($XS::APItest::exception_caught, 1);
ef469b03 32
7e7a3dfc 33$rv = eval { mycroak("foobar\n"); 1 };
ef469b03 34is($@, "foobar\n", 'croak');
7e7a3dfc 35ok(not defined $rv);
36
37$rv = eval { $@ = bless{}, "foo"; mycroak(undef); 1 };
38is(ref($@), "foo", 'croak(NULL)');
39ok(not defined $rv);