File: old_7_attach.t

package info (click to toggle)
libmail-mboxparser-perl 0.51-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 260 kB
  • ctags: 78
  • sloc: perl: 1,415; makefile: 51
file content (43 lines) | stat: -rwxr-xr-x 702 bytes parent folder | download
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
#! /usr/bin/perl -w

use Test;
use File::Spec;
use strict;

use lib '../..';
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);