X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fmsg_iter.t;h=f6fd3bb025c9d5d247b4500527458b1386136286;hb=dde1b083571ed893cbb1990f01f9e11ed804cba5;hp=cc58b93fd6ffff9d8f3b0e81975a71533e6ae6f8;hpb=4f7977b42aab1595b3a45b41e19499b38c46c8cc;p=public-inbox.git diff --git a/t/msg_iter.t b/t/msg_iter.t index cc58b93f..f6fd3bb0 100644 --- a/t/msg_iter.t +++ b/t/msg_iter.t @@ -1,4 +1,4 @@ -# Copyright (C) 2016 all contributors +# Copyright (C) 2016-2019 all contributors # License: AGPL-3.0+ use strict; use warnings; @@ -7,14 +7,16 @@ use Email::MIME; use_ok('PublicInbox::MsgIter'); { - my $parts = [ Email::MIME->create(body => 'a'), - Email::MIME->create(body => 'b') ]; + my $parts = [ Email::MIME->create(body => "a\n"), + Email::MIME->create(body => "b\n") ]; my $mime = Email::MIME->create(parts => $parts, header_str => [ From => 'root@localhost' ]); my @parts; msg_iter($mime, sub { my ($part, $level, @ex) = @{$_[0]}; - push @parts, [ $part->body_str, $level, @ex ]; + my $s = $part->body_str; + $s =~ s/\s+//s; + push @parts, [ $s, $level, @ex ]; }); is_deeply(\@parts, [ [ qw(a 1 1) ], [ qw(b 1 2) ] ], 'order is fine'); } @@ -30,9 +32,11 @@ use_ok('PublicInbox::MsgIter'); my @parts; msg_iter($mime, sub { my ($part, $level, @ex) = @{$_[0]}; - push @parts, [ $part->body_str, $level, @ex ]; + my $s = $part->body_str; + $s =~ s/\s+//s; + push @parts, [ $s, $level, @ex ]; }); - is_deeply(\@parts, [ [ qw(a 2 1 1)], [qw(b 2 1 2)], [qw(sig 1 2)] ], + is_deeply(\@parts, [ [qw(a 2 1 1)], [qw(b 2 1 2)], [qw(sig 1 2)] ], 'nested part shows up properly'); }