File: EmptyPart.t

package info (click to toggle)
libmime-tools-perl 5.515-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,612 kB
  • sloc: perl: 6,349; makefile: 8
file content (38 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (10)
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
#!/usr/bin/perl -w
use strict;
use warnings;
use Test::More tests => 6;

use MIME::Tools;

use lib "./t";
use Globby;

use MIME::Parser;


my $DIR = "./testout";
((-d $DIR) && (-w $DIR)) or die "no output directory $DIR";
unlink globby("$DIR/[a-z]*");

my $parser = MIME::Parser->new();
$parser->output_dir($DIR);

my $data = <<END;
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="foo"

--foo
--foo
--foo
--foo--
END

my $entity = $parser->parse_data($data);
ok($entity, 'Got an entity');
is($entity->mime_type, 'multipart/alternative');
is($entity->parts, 3, 'Got three parts');
is($entity->parts(0)->mime_type, 'text/plain');
is($entity->parts(1)->mime_type, 'text/plain');
is($entity->parts(2)->mime_type, 'text/plain');