1 # Copyright (C) 2016-2018 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');