diff options
author | Eric Wong <e@yhbt.net> | 2020-04-18 03:38:46 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-04-19 08:51:17 +0000 |
commit | 0f6b0cac5bf10d036a84dbab732e8991edf56c34 (patch) | |
tree | 043acb6313f02f5c3e934cdd48a7730c375defb7 /t/mda.t | |
parent | d0147582e289fdd4cdd84e91d8b0f8ae9c230124 (diff) | |
download | public-inbox-0f6b0cac5bf10d036a84dbab732e8991edf56c34.tar.gz |
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.
Diffstat (limited to 't/mda.t')
-rw-r--r-- | t/mda.t | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -7,6 +7,7 @@ use Email::MIME; use Cwd qw(getcwd); use PublicInbox::MID qw(mid2path); use PublicInbox::Git; +use PublicInbox::InboxWritable; use PublicInbox::TestCommon; my ($tmpdir, $for_destroy) = tmpdir(); my $home = "$tmpdir/pi-home"; @@ -62,12 +63,9 @@ local $ENV{GIT_COMMITTER_NAME} = eval { use PublicInbox::MDA; use PublicInbox::Address; use Encode qw/encode/; - my $mbox = 't/utf8.mbox'; - open(my $fh, '<', $mbox) or die "failed to open mbox: $mbox\n"; - my $str = eval { local $/; <$fh> }; - close $fh; - my $msg = Email::MIME->new($str); - + my $eml = 't/utf8.eml'; + my $msg = PublicInbox::InboxWritable::mime_from_path($eml) or + die "failed to open $eml: $!"; my $from = $msg->header('From'); my ($author) = PublicInbox::Address::names($from); my ($email) = PublicInbox::Address::emails($from); |