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
|
use Test;
use File::Spec;
use strict;
use Mail::MboxParser;
my $src = File::Spec->catfile('t', 'testbox');
BEGIN { plan tests => 19 };
my $mb = Mail::MboxParser->new($src, oldparser => 1);
# 1 - 9
my $c = 0;
for my $msg ($mb->get_messages) {
if ($c == 8) {
ok($msg->get_attachments('Plans'), 2);
}
else {
ok ($msg->get_attachments, undef);
}
$c++;
}
# 10 - 18
$c = 0;
while (my $msg = $mb->next_message) {
if ($c == 8) {
ok($msg->get_attachments('Plans'), 2);
}
else {
ok ($msg->get_attachments, undef);
}
$c++;
}
# 19
ok($mb->get_message(8)->get_attachments('Plans'), 2);
|