summaryrefslogtreecommitdiff
path: root/cpan/dist/MIME-Lite/t/verify.t
blob: bb2542390989a7f38b002cb159cc35f2e37b0738 (plain)
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
#!/usr/bin/perl
use lib "lib", "t";
use MIME::Lite;
use ExtUtils::TBone;
use Utils;

# Make a tester... here are 3 different alternatives:
my $T = typical ExtUtils::TBone;                 # standard log
$MIME::Lite::VANILLA  = 1;
$MIME::Lite::PARANOID = 1;

# Begin testing:
$T->begin(2);

my $msg;

$msg  = MIME::Lite->new(From=>"me", To=>"you");
$msg->attach(Path => "boguscmd |");
$msg->attach(Data => "Hello");
$msg->attach(Path => "<path.to.missing.file");
eval { $msg->verify_data };
$T->ok($@ =~ /path\.to\.missing\.file/,
       "Did we detect a missing file?",
       Error => $@);

$msg  = MIME::Lite->new(From=>"me", To=>"you");
$msg->attach(Data => "Hello");
eval { $msg->verify_data };
$T->ok(!$@,
       "Did we detect NO missing file?",
       Error => $@);


$T->end;