File: 7_attach.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 (43 lines) | stat: -rwxr-xr-x 828 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
41
42
43
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, 
                parseropts => { cache_file_name => 
                                    File::Spec->catfile(qw/t cache/),
                                enable_cache    => 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);