PageRenderTime 480ms CodeModel.GetById 9ms 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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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. # adapted from ../python/exception_order_runme.py
  8. my $a = exception_order::A->new();
  9. eval { $a->foo() };
  10. isa_ok($@, "exception_order::E1");
  11. eval { $a->bar() };
  12. isa_ok($@, "exception_order::E2");
  13. eval { $a->foobar() };
  14. like($@, qr/\bpostcatch unknown\b/);
  15. eval { $a->barfoo(1) };
  16. isa_ok($@, "exception_order::E1");
  17. eval { $a->barfoo(2) };
  18. isa_ok($@, "exception_order::E2");