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;
|