File: 03-nice.t

package info (click to toggle)
libhttp-exception-perl 0.04007-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 300 kB
  • sloc: perl: 232; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 818 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use strict;

use Test::Exception;
use Test::More;
use HTTP::Exception;

# do we play nicely with other user defined exception?

use Exception::Class ('User::Defined::Exception' => {});

throws_ok sub { User::Defined::Exception->throw; }, 'User::Defined::Exception';

eval { User::Defined::Exception->throw; };
ok !defined HTTP::Exception->caught        , 'HTTP::Exception not caught';
ok defined User::Defined::Exception->caught, 'User::Defined::Exception caught';
ok defined Exception::Class->caught        , 'Exception::Class caught';

eval { HTTP::Exception::200->throw; };
ok defined HTTP::Exception->caught        , 'HTTP::Exception caught';
ok !defined User::Defined::Exception->caught, 'User::Defined::Exception not caught';
ok defined Exception::Class->caught        , 'Exception::Class caught';

done_testing;