File: fail-multi.t

package info (click to toggle)
libemail-sender-perl 2.601-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 468 kB
  • sloc: perl: 2,276; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 1,215 bytes parent folder | download | duplicates (8)
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
32
33
34
35
36
37
38
39
40
41
42
#!perl
use strict;
use warnings;
use Test::More tests => 5;

use Email::Sender::Failure;
use Email::Sender::Failure::Permanent;
use Email::Sender::Failure::Temporary;
use Email::Sender::Failure::Multi;

my $fail = Email::Sender::Failure->new("generic");
my $perm = Email::Sender::Failure::Permanent->new("permanent");
my $temp = Email::Sender::Failure::Temporary->new("temporary");

my $multi_fail = Email::Sender::Failure::Multi->new({
  message  => 'multifail',
  failures => [ $fail ],
});

isa_ok($multi_fail, 'Email::Sender::Failure', 'multi(Failure)');
ok(! $multi_fail->isa('Nothing::Is::This'), 'isa is not catholic');

my $multi_perm = Email::Sender::Failure::Multi->new({
  message  => 'multifail',
  failures => [ $perm ],
});

isa_ok($multi_perm, 'Email::Sender::Failure::Permanent', 'multi(Failure::P)');

my $multi_temp = Email::Sender::Failure::Multi->new({
  message  => 'multifail',
  failures => [ $temp ],
});

isa_ok($multi_temp, 'Email::Sender::Failure::Temporary', 'multi(Failure::T)');

my $multi_mixed = Email::Sender::Failure::Multi->new({
  message  => 'multifail',
  failures => [ $fail, $perm, $temp ],
});

ok(! $multi_mixed->isa('Email::Sender::Failure::Temporary'), 'mixed <> temp');