1use Test;
2use File::Spec;
3use strict;
4
5use Mail::MboxParser;
6
7my $src = File::Spec->catfile('t', 'testbox');
8
9BEGIN { plan tests => 18 };
10
11my $mb    = Mail::MboxParser->new($src, oldparser => 1);
12my @mails;
13
14for (0 .. $mb->nmsgs - 1) {
15    push @mails, $mb->get_message($_);
16}
17
18# 1 - 8
19print "Testing body-idx...\n";
20for my $msg (@mails[0..7]) {
21    ok($msg->find_body, 0);
22}
23
24# 9
25print "Testing body-idx on multipart...\n";
26ok($mails[8]->find_body, 1);
27
28# 10 - 12
29print "Signature for mail 1, 2, 9...\n";
30for my $msg (@mails[0,1,8]) {
31    ok($msg->body($msg->find_body)->signature);
32}
33
34# 13 - 18
35print "No signature for mails 3, 4, 5, 6, 7, 8...\n";
36for my $msg (@mails[2..7]) {
37    my $body = $msg->body($msg->find_body);
38    my @n = $body->signature;
39    ok($body->error);
40}
41