From 0f6b0cac5bf10d036a84dbab732e8991edf56c34 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 18 Apr 2020 03:38:46 +0000 Subject: inboxwritable: mime_from_path: reuse in more places There's nothing Maildir-specific about the function, so `maildir_path_load' was a bad name. So give it a more appropriate name and use it in our tests. This save ourselves some code and inconsistency by reusing an existing internal library routine in more places. We can drop the "From_" line in some of our (formerly) mbox sample files. --- t/msg_iter.t | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 't/msg_iter.t') diff --git a/t/msg_iter.t b/t/msg_iter.t index d303564f..573ee412 100644 --- a/t/msg_iter.t +++ b/t/msg_iter.t @@ -5,6 +5,7 @@ use warnings; use Test::More; use Email::MIME; use PublicInbox::Hval qw(ascii_html); +use PublicInbox::InboxWritable; use_ok('PublicInbox::MsgIter'); { @@ -42,12 +43,9 @@ use_ok('PublicInbox::MsgIter'); } { - my $f = 't/iso-2202-jp.mbox'; - my $mime = Email::MIME->new(do { - open my $fh, '<', $f or die "open($f): $!"; - local $/; - <$fh>; - }); + my $f = 't/iso-2202-jp.eml'; + my $mime = PublicInbox::InboxWritable::mime_from_path($f) or + die "open $f: $!"; my $raw = ''; msg_iter($mime, sub { my ($part, $level, @ex) = @{$_[0]}; @@ -61,12 +59,8 @@ use_ok('PublicInbox::MsgIter'); { my $f = 't/x-unknown-alpine.eml'; - my $mime = Email::MIME->new(do { - open my $fh, '<', $f or die "open($f): $!"; - local $/; - binmode $fh; - <$fh>; - }); + my $mime = PublicInbox::InboxWritable::mime_from_path($f) or + die "open $f: $!"; my $raw = ''; msg_iter($mime, sub { my ($part, $level, @ex) = @{$_[0]}; -- cgit v1.2.3-24-ge0c7