File: 5_body.t

package info (click to toggle)
libmail-mboxparser-perl 0.55-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 404 kB
  • sloc: perl: 1,011; makefile: 2
file content (40 lines) | stat: -rwxr-xr-x 763 bytes parent folder | download | duplicates (7)
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 => 18 };

my $mb    = Mail::MboxParser->new($src);
my @mails; 

for (0 .. $mb->nmsgs - 1) {
    push @mails, $mb->get_message($_);
}

# 1 - 8
print "Testing body-idx...\n";
for my $msg (@mails[0..7]) {
    ok($msg->find_body, 0);
}

# 9
print "Testing body-idx on multipart...\n";
ok($mails[8]->find_body, 1);

# 10 - 12
print "Signature for mail 1, 2, 9...\n";
for my $msg (@mails[0,1,8]) {
    ok($msg->body($msg->find_body)->signature);
}

# 13 - 18
print "No signature for mails 3, 4, 5, 6, 7, 8...\n";
for my $msg (@mails[2..7]) {
    my $body = $msg->body($msg->find_body);
    my @n = $body->signature;
    ok($body->error);
}