about summary refs log tree commit homepage
path: root/t/mid.t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-21 21:16:13 +0000
committerEric Wong <e@yhbt.net>2020-04-22 18:26:01 +0000
commite6b7a7f5f70fb89a54ff158bc6c8b564149947e5 (patch)
treecd04e08c3f866875586774959fdb64e7e6bb78e8 /t/mid.t
parent62d1a4da996bd9a664be954f71f78fe052f9df16 (diff)
downloadpublic-inbox-e6b7a7f5f70fb89a54ff158bc6c8b564149947e5.tar.gz
Instead, favor PublicInbox::MIME->new for non-attachment emails.
We may support alternatives to Email::MIME down the line.

We'll still keep Email::MIME->create to deal with attachments,
for now, but there's also a fair amount of test duplication
we should eliminate, later.
Diffstat (limited to 't/mid.t')
-rw-r--r--t/mid.t5
1 files changed, 2 insertions, 3 deletions
diff --git a/t/mid.t b/t/mid.t
index 9815d384..0ad81d7d 100644
--- a/t/mid.t
+++ b/t/mid.t
@@ -2,6 +2,7 @@
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use Test::More;
+use PublicInbox::MIME;
 use PublicInbox::MID qw(mid_escape mids references mids_for_index id_compress);
 
 is(mid_escape('foo!@(bar)'), 'foo!@(bar)');
@@ -15,10 +16,8 @@ like(id_compress('foo%bar@wtf'), qr/\A[a-f0-9]{40}\z/,
 is(id_compress('foobar-wtf'), 'foobar-wtf', 'regular ID not compressed');
 
 {
-        use Email::MIME;
-        my $mime = Email::MIME->create;
+        my $mime = PublicInbox::MIME->new("Message-ID: <mid-1\@a>\n\n");
         $mime->header_set('X-Alt-Message-ID', '<alt-id-for-nntp>');
-        $mime->header_set('Message-Id', '<mid-1@a>');
         is_deeply(['mid-1@a'], mids($mime->header_obj), 'mids in common case');
         $mime->header_set('Message-Id', '<mid-1@a>', '<mid-2@b>');
         is_deeply(['mid-1@a', 'mid-2@b'], mids($mime->header_obj), '2 mids');