import source from 1.3.40
[external/swig.git] / Examples / test-suite / perl5 / exception_order_runme.pl
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use Test::More tests => 7;
5 BEGIN { use_ok('exception_order') }
6 require_ok('exception_order');
7
8 # adapted from ../python/exception_order_runme.py
9
10 my $a = exception_order::A->new();
11
12 eval { $a->foo() };
13 isa_ok($@, "exception_order::E1");
14
15 eval { $a->bar() };
16 isa_ok($@, "exception_order::E2");
17
18 eval { $a->foobar() };
19 like($@, qr/\bpostcatch unknown\b/);
20
21 eval { $a->barfoo(1) };
22 isa_ok($@, "exception_order::E1");
23
24 eval { $a->barfoo(2) };
25 isa_ok($@, "exception_order::E2");