File: Catmandu-Error.t

package info (click to toggle)
libcatmandu-perl 1.2024-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,552 kB
  • sloc: perl: 17,037; makefile: 24; sh: 1
file content (31 lines) | stat: -rw-r--r-- 847 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env perl

use strict;
use warnings;
use Test::More;
use Test::Exception;

my $pkg;

BEGIN {
    $pkg = 'Catmandu::Error';
    use_ok $pkg;
}
require_ok $pkg;

throws_ok {Catmandu::Error->throw("Oops!");} 'Catmandu::Error',
    qq|caught an error|;
throws_ok {Catmandu::Error->throw;} 'Catmandu::Error',
    qq|caught an error with no message|;
is(Catmandu::Error->new->message,
    '', qq|default error message is an empty string|);
throws_ok {Catmandu::BadVal->throw("Whoo!");} 'Catmandu::BadVal',
    qq|caught a badval|;
throws_ok {Catmandu::BadArg->throw("Aarrgh!");} 'Catmandu::BadArg',
    qq|caught a badarg|;
throws_ok {Catmandu::BadArg->throw("Aarrgh!");} 'Catmandu::BadArg',
    qq|caught a badarg|;
throws_ok {Catmandu::NotImplemented->throw("Huh?!");}
'Catmandu::NotImplemented', qq|caught a notimplemented|;

done_testing;