PageRenderTime 34ms CodeModel.GetById 29ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/test-suite/perl5/exception_order_runme.pl

#
Perl | 25 lines | 16 code | 7 blank | 2 comment | 0 complexity | c5840fca644df3ebbc4b2e943c38a496 MD5 | raw file
 1#!/usr/bin/perl
 2use strict;
 3use warnings;
 4use Test::More tests => 7;
 5BEGIN { use_ok('exception_order') }
 6require_ok('exception_order');
 7
 8# adapted from ../python/exception_order_runme.py
 9
10my $a = exception_order::A->new();
11
12eval { $a->foo() };
13isa_ok($@, "exception_order::E1");
14
15eval { $a->bar() };
16isa_ok($@, "exception_order::E2");
17
18eval { $a->foobar() };
19like($@, qr/\bpostcatch unknown\b/);
20
21eval { $a->barfoo(1) };
22isa_ok($@, "exception_order::E1");
23
24eval { $a->barfoo(2) };
25isa_ok($@, "exception_order::E2");