1 # Copyright (C) 2016-2019 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
7 use_ok('PublicInbox::MsgIter');
10 my $parts = [ Email::MIME->create(body => "a\n"),
11 Email::MIME->create(body => "b\n") ];
12 my $mime = Email::MIME->create(parts => $parts,
13 header_str => [ From => 'root@localhost' ]);
16 my ($part, $level, @ex) = @{$_[0]};
17 my $s = $part->body_str;
19 push @parts, [ $s, $level, @ex ];
21 is_deeply(\@parts, [ [ qw(a 1 1) ], [ qw(b 1 2) ] ], 'order is fine');
25 my $parts = [ Email::MIME->create(body => 'a'),
26 Email::MIME->create(body => 'b') ];
27 $parts = [ Email::MIME->create(parts => $parts,
28 header_str => [ From => 'sub@localhost' ]),
29 Email::MIME->create(body => 'sig') ];
30 my $mime = Email::MIME->create(parts => $parts,
31 header_str => [ From => 'root@localhost' ]);
34 my ($part, $level, @ex) = @{$_[0]};
35 my $s = $part->body_str;
37 push @parts, [ $s, $level, @ex ];
39 is_deeply(\@parts, [ [qw(a 2 1 1)], [qw(b 2 1 2)], [qw(sig 1 2)] ],
40 'nested part shows up properly');
44 my $f = 't/iso-2202-jp.mbox';
45 my $mime = Email::MIME->new(do {
46 open my $fh, '<', $f or die "open($f): $!";
52 my ($part, $level, @ex) = @{$_[0]};
53 my ($s, $err) = msg_part_text($part, 'text/plain');
54 ok(!$err, 'no error');
57 ok(length($raw) > 0, 'got non-empty message');
58 is(index($raw, '$$$'), -1, 'no unescaped $$$');