t/altid.t | 19 +++++++++---------- t/altid_v2.t | 19 +++++++++---------- t/cgi.t | 8 ++++---- t/content_id.t | 24 +++++++++++------------- t/convert-compact.t | 22 +++++++++++----------- t/feed.t | 6 +++--- t/filter_rubylang.t | 8 ++++---- t/filter_subjecttag.t | 4 ++-- t/filter_vger.t | 6 +++--- t/html_index.t | 4 ++-- t/httpd.t | 4 ++-- t/import.t | 22 ++++++++++------------ t/indexlevels-mirror.t | 19 +++++++++---------- t/mid.t | 5 ++--- t/msgtime.t | 51 +++++++++++++++++++++++---------------------------- t/nntp.t | 4 ++-- t/nntpd.t | 4 ++-- t/nulsubject.t | 18 ++++++++---------- t/plack.t | 4 ++-- t/psgi_attach.t | 2 +- t/psgi_mount.t | 4 ++-- t/psgi_multipart_not.t | 2 +- t/psgi_scan_all.t | 2 +- t/psgi_search.t | 2 +- t/psgi_text.t | 2 +- t/reply.t | 4 ++-- t/search-thr-index.t | 6 +++--- t/search.t | 197 ++++++++++++++++++++++++++--------------------------- t/time.t | 23 +++++++++++------------ t/v1-add-remove-add.t | 22 +++++++++++----------- t/v1reindex.t | 20 ++++++++++---------- t/v2-add-remove-add.t | 22 +++++++++++----------- t/v2mda.t | 23 +++++++++++------------ t/v2reindex.t | 18 ++++++++---------- t/v2writable.t | 20 +++++++++----------- t/watch_maildir.t | 2 +- t/xcpdb-reshard.t | 17 +++++++---------- diff --git a/t/altid.t b/t/altid.t index 3134e6276b54fea21cd943c7210e03e482ae2118..c7a3601a6b196f03f5111c11f89bb0b8e57f1528 100644 --- a/t/altid.t +++ b/t/altid.t @@ -4,6 +4,7 @@ use strict; use warnings; use Test::More; use PublicInbox::TestCommon; +use PublicInbox::MIME; require_mods(qw(DBD::SQLite Search::Xapian)); use_ok 'PublicInbox::Msgmap'; use_ok 'PublicInbox::SearchIdx'; @@ -26,16 +27,14 @@ { my $git = PublicInbox::Git->new($git_dir); my $im = PublicInbox::Import->new($git, 'testbox', 'test@example'); $im->init_bare; - $im->add(Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'b@example.com', - 'Content-Type' => 'text/plain', - Subject => 'boo!', - 'Message-ID' => '', - ], - body => "hello world gmane:666\n", - )); + $im->add(PublicInbox::MIME->new(<<'EOF')); +From: a@example.com +To: b@example.com +Subject: boo! +Message-ID: + +hello world gmane:666 +EOF $im->done; } { diff --git a/t/altid_v2.t b/t/altid_v2.t index f31061c2f8c94cc35747218a89a5afe65134b52c..3ac294f05b3b005f9e2683b165d4daeb2d4db376 100644 --- a/t/altid_v2.t +++ b/t/altid_v2.t @@ -3,6 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; +use PublicInbox::MIME; use PublicInbox::TestCommon; require_git(2.6); require_mods(qw(DBD::SQLite Search::Xapian)); @@ -30,16 +31,14 @@ altid => $altid, }; $ibx = PublicInbox::Inbox->new($ibx); my $v2w = PublicInbox::V2Writable->new($ibx, 1); -$v2w->add(Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'b@example.com', - 'Content-Type' => 'text/plain', - Subject => 'boo!', - 'Message-ID' => '', - ], - body => "hello world gmane:666\n", - )); +$v2w->add(PublicInbox::MIME->new(<<'EOF')); +From: a@example.com +To: b@example.com +Subject: boo! +Message-ID: + +hello world gmane:666 +EOF $v2w->done; my $msgs = $ibx->search->reopen->query("gmane:1234"); diff --git a/t/cgi.t b/t/cgi.t index bceb83e57de42608c7e3ad9400afc512af03cbec..42a343d3040f06303fb42a09cce5c22f6b07f65a 100644 --- a/t/cgi.t +++ b/t/cgi.t @@ -5,7 +5,7 @@ # should be moved over to things which use test_psgi use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::TestCommon; use PublicInbox::Import; require_mods(qw(Plack::Handler::CGI Plack::Util)); @@ -45,7 +45,7 @@ { local $ENV{HOME} = $home; # inject some messages: - my $mime = Email::MIME->new(<new(< To: You Cc: $addr @@ -62,7 +62,7 @@ $mime->body_str_set("z\n" x 1024); ok($im->add($mime), 'added big message'); # deliver a reply, too - $mime = Email::MIME->new(<new(< To: Me Cc: $addr @@ -79,7 +79,7 @@ EOF ok($im->add($mime), 'added reply'); my $slashy_mid = 'slashy/asdf@example.com'; - my $slashy = Email::MIME->new(<new(< To: Me Cc: $addr diff --git a/t/content_id.t b/t/content_id.t index 3fe44b95c6fd9bc1b4b28a1616138de580e279f9..0325164df77de292075b2ec8c885e5642cf8a1b8 100644 --- a/t/content_id.t +++ b/t/content_id.t @@ -4,22 +4,20 @@ use strict; use warnings; use Test::More; use PublicInbox::ContentId qw(content_id); -use Email::MIME; +use PublicInbox::MIME; -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'b@example.com', - 'Content-Type' => 'text/plain', - Subject => 'this is a subject', - 'Message-ID' => '', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: b@example.com +Subject: this is a subject +Message-ID: +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +hello world +EOF my $orig = content_id($mime); -my $reload = content_id(Email::MIME->new($mime->as_string)); +my $reload = content_id(PublicInbox::MIME->new($mime->as_string)); is($orig, $reload, 'content_id matches after serialization'); foreach my $h (qw(From To Cc)) { diff --git a/t/convert-compact.t b/t/convert-compact.t index 376e0f6a8b15709bd15e9411e5660695f5377d0b..ae29902123c6f12ca8e6bf8c01cabfafe5b11f10 100644 --- a/t/convert-compact.t +++ b/t/convert-compact.t @@ -7,7 +7,7 @@ use PublicInbox::MIME; use PublicInbox::Spawn qw(which); use PublicInbox::TestCommon; require_git(2.6); -require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); +require_mods(qw(DBD::SQLite Search::Xapian)); which('xapian-compact') or plan skip_all => 'xapian-compact missing for '.__FILE__; @@ -26,16 +26,16 @@ ok(PublicInbox::Import::run_die([qw(git) , "--git-dir=$ibx->{inboxdir}", qw(config core.sharedRepository 0644)]), 'set sharedRepository'); $ibx = PublicInbox::Inbox->new($ibx); my $im = PublicInbox::Import->new($ibx->git, undef, undef, $ibx); -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - 'Message-ID' => '', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: b@example.com +Subject: this is a subject +Message-ID: +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +hello world +EOF + ok($im->add($mime), 'added one message'); ok($im->remove($mime), 'remove message'); ok($im->add($mime), 'added message again'); diff --git a/t/feed.t b/t/feed.t index 7d01e3e6524c50c491690bc100e460c9abc3de18..373a1de825a72f647f4d25d818e6a58dfb0427db 100644 --- a/t/feed.t +++ b/t/feed.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::Feed; use PublicInbox::Import; use PublicInbox::Inbox; @@ -36,7 +36,7 @@ { $im->init_bare; foreach my $i (1..6) { - my $mime = Email::MIME->new(<new(< To: U Message-Id: <$i\@example.com> @@ -95,7 +95,7 @@ # add a new spam message my $spam; { - $spam = Email::MIME->new(<new(< To: U Message-Id: diff --git a/t/filter_rubylang.t b/t/filter_rubylang.t index 8215b6f109e8323728cfa2f897ed5dd35f39f477..05e1b324da5742caf35d58d622c9444b2bdc46b7 100644 --- a/t/filter_rubylang.t +++ b/t/filter_rubylang.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::TestCommon; use_ok 'PublicInbox::Filter::RubyLang'; @@ -17,7 +17,7 @@ Unsubscribe: EOF -my $mime = Email::MIME->new($msg); +my $mime = PublicInbox::MIME->new($msg); my $ret = $f->delivery($mime); is($ret, $mime, "delivery successful"); is($mime->body, "keep this\n", 'normal message filtered OK'); @@ -41,7 +41,7 @@ X-Mail-Count: 12 Message-ID: EOF - $mime = Email::MIME->new($msg); + $mime = PublicInbox::MIME->new($msg); $ret = $f->delivery($mime); is($ret, $mime, "delivery successful"); my $mm = PublicInbox::Msgmap->new($git_dir); @@ -53,7 +53,7 @@ Message-ID: EOF - $mime = Email::MIME->new($msg); + $mime = PublicInbox::MIME->new($msg); $ret = $f->delivery($mime); is($ret, 100, "delivery rejected without X-Mail-Count"); } diff --git a/t/filter_subjecttag.t b/t/filter_subjecttag.t index 922499d59267aba5753a0122ca5f007a2ea9f128..9b397b8c2466e8fd44c04ebdbbff1b0fa5ae8b4f 100644 --- a/t/filter_subjecttag.t +++ b/t/filter_subjecttag.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use_ok 'PublicInbox::Filter::SubjectTag'; my $f = eval { PublicInbox::Filter::SubjectTag->new }; @@ -11,7 +11,7 @@ like($@, qr/tag not defined/, 'error without args'); $f = PublicInbox::Filter::SubjectTag->new('-tag', '[foo]'); is(ref $f, 'PublicInbox::Filter::SubjectTag', 'new object created'); -my $mime = Email::MIME->new(<new(< Subject: =?UTF-8?B?UmU6IFtmb29dIEVsw4PCqWFub3I=?= diff --git a/t/filter_vger.t b/t/filter_vger.t index 0f0562ed855078029ad497c01b4a3e1c409212c9..9d71f16d03c8463980f4742ad21f3be277d4be6d 100644 --- a/t/filter_vger.t +++ b/t/filter_vger.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use_ok 'PublicInbox::Filter::Vger'; my $f = PublicInbox::Filter::Vger->new; @@ -21,7 +21,7 @@ More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ EOF - my $mime = Email::MIME->new($lkml); + my $mime = PublicInbox::MIME->new($lkml); $mime = $f->delivery($mime); is("keep this\n", $mime->body, 'normal message filtered OK'); } @@ -37,7 +37,7 @@ the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html EOF - my $mime = Email::MIME->new($no_nl); + my $mime = PublicInbox::MIME->new($no_nl); $mime = $f->delivery($mime); is('OSX users :P', $mime->body, 'missing trailing LF in original OK'); } diff --git a/t/html_index.t b/t/html_index.t index fda3962af646dfd52587eca56296e925637ac291..51897532f26a3f71ceaf1d13ccbba70ff5536301 100644 --- a/t/html_index.t +++ b/t/html_index.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::Feed; use PublicInbox::Git; use PublicInbox::Import; @@ -32,7 +32,7 @@ if ($prev) { $mid_line .= "In-Reply-To: $prev"; } $prev = $mid; - my $mime = Email::MIME->new(<new(< To: U $mid_line diff --git a/t/httpd.t b/t/httpd.t index 61aec3b4436bd5db64c09d46015488a391091ca8..f4fbd5330be2e0b874c579216eeff56ed7f7f12c 100644 --- a/t/httpd.t +++ b/t/httpd.t @@ -4,6 +4,7 @@ use strict; use warnings; use Test::More; use PublicInbox::TestCommon; +use PublicInbox::MIME; use Socket qw(IPPROTO_TCP SOL_SOCKET); require_mods(qw(Plack::Util Plack::Builder HTTP::Date HTTP::Status)); @@ -20,7 +21,6 @@ my $sock = tcp_server(); my $td; use_ok 'PublicInbox::Git'; use_ok 'PublicInbox::Import'; -use_ok 'Email::MIME'; { local $ENV{HOME} = $home; my $cmd = [ '-init', $group, $maindir, 'http://example.com/', $addr ]; @@ -28,7 +28,7 @@ ok(run_script($cmd), 'init ran properly'); # ensure successful message delivery { - my $mime = Email::MIME->new(<new(< To: You Cc: $addr diff --git a/t/import.t b/t/import.t index 53345b12fb5b6ee54ec0b957028b3c7d9a54fc18..d2264102dc4fdbd0e544bdf762afdfb234570d61 100644 --- a/t/import.t +++ b/t/import.t @@ -10,23 +10,21 @@ use PublicInbox::Spawn qw(spawn); use Fcntl qw(:DEFAULT SEEK_SET); use File::Temp qw/tempfile/; use PublicInbox::TestCommon; -require_mods(qw(Email::MIME)); my ($dir, $for_destroy) = tmpdir(); my $git = PublicInbox::Git->new($dir); my $im = PublicInbox::Import->new($git, 'testbox', 'test@example'); $im->init_bare; -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'b@example.com', - 'Content-Type' => 'text/plain', - Subject => 'this is a subject', - 'Message-ID' => '', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: b@example.com +Subject: this is a subject +Message-ID: +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +hello world +EOF + my $v2 = require_git(2.6, 1); my $smsg = {} if $v2; like($im->add($mime, undef, $smsg), qr/\A:[0-9]+\z/, 'added one message'); diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index 90506e2846fc1aa428403c77d1439686d649672b..dcd5dc39128ec8f0f3884e1f458cd117062e13d2 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -10,17 +10,16 @@ require PublicInbox::Admin; use PublicInbox::TestCommon; my $PI_TEST_VERSION = $ENV{PI_TEST_VERSION} || 2; require_git('2.6') if $PI_TEST_VERSION == 2; -require_mods(qw(DBD::SQLite Email::MIME)); +require_mods(qw(DBD::SQLite)); -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +hello world +EOF sub import_index_incremental { my ($v, $level, $mime) = @_; diff --git a/t/mid.t b/t/mid.t index 9815d384966abc0d6d3f966c980cdbc660efceae..0ad81d7da8be71011bdb0cef047ecaec73519053 100644 --- a/t/mid.t +++ b/t/mid.t @@ -2,6 +2,7 @@ # Copyright (C) 2016-2020 all contributors # License: AGPL-3.0+ 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 @@ 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: \n\n"); $mime->header_set('X-Alt-Message-ID', ''); - $mime->header_set('Message-Id', ''); is_deeply(['mid-1@a'], mids($mime->header_obj), 'mids in common case'); $mime->header_set('Message-Id', '', ''); is_deeply(['mid-1@a', 'mid-2@b'], mids($mime->header_obj), '2 mids'); diff --git a/t/msgtime.t b/t/msgtime.t index 058f38864b9934061360ab717f347725f2e79538..d9f8e6417d5bd3de73c636a5a1c2cf9327e7a0ec 100644 --- a/t/msgtime.t +++ b/t/msgtime.t @@ -6,28 +6,23 @@ use Test::More; use PublicInbox::MIME; use PublicInbox::MsgTime; use PublicInbox::TestCommon; -require_mods(qw(Email::MIME)); our $received_date = 'Mon, 22 Jan 2007 13:16:24 -0500'; sub datestamp ($) { my ($date) = @_; local $SIG{__WARN__} = sub {}; # Suppress warnings - my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'b@example.com', - 'Content-Type' => 'text/plain', - Subject => 'this is a subject', - 'Message-ID' => '', - Date => $date, - 'Received' => <); -\t$received_date + my $mime = PublicInbox::MIME->new(<<"EOF"); +From: a\@example.com +To: b\@example.com +Subject: this is a subject +Message-ID: +Date: $date +Received: (majordomo\@vger.kernel.org) by vger.kernel.org via listexpand + id S932173AbXAVSQY (ORCPT ); + $received_date + +hello world EOF - ], - body => "hello world\n", - ); my @ts = PublicInbox::MsgTime::msg_datestamp($mime->header_obj); return \@ts; } @@ -35,18 +30,18 @@ sub timestamp ($) { my ($received) = @_; local $SIG{__WARN__} = sub {}; # Suppress warnings - my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'b@example.com', - 'Content-Type' => 'text/plain', - Subject => 'this is a subject', - 'Message-ID' => '', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - 'Received' => '(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S932173AbXAVSQY (ORCPT );\n\t' . $received, - ], - body => "hello world\n", - ); + my $mime = PublicInbox::MIME->new(<<"EOF"); +From: a\@example.com +To: b\@example.com +Subject: this is a subject +Message-ID: +Date: Fri, 02 Oct 1993 00:00:00 +0000 +Received: (majordomo\@vger.kernel.org) by vger.kernel.org via listexpand + id S932173AbXAVSQY (ORCPT ); + $received + +hello world +EOF my @ts = PublicInbox::MsgTime::msg_timestamp($mime->header_obj); return \@ts; } diff --git a/t/nntp.t b/t/nntp.t index ff72ec6a001cabc92d725154608a7bda2956702a..35fb55b42ccfec723a2dfa734222d8aedd648b9c 100644 --- a/t/nntp.t +++ b/t/nntp.t @@ -4,6 +4,7 @@ use strict; use warnings; use Test::More; use PublicInbox::TestCommon; +use PublicInbox::MIME; require_mods(qw(DBD::SQLite Data::Dumper)); use_ok 'PublicInbox::NNTP'; use_ok 'PublicInbox::Inbox'; @@ -96,7 +97,6 @@ } } { # test setting NNTP headers in HEAD and ARTICLE requests - require Email::MIME; my $u = 'https://example.com/a/'; my $ng = PublicInbox::Inbox->new({ name => 'test', inboxdir => 'test.git', @@ -107,7 +107,7 @@ domain => 'example.com', url => [ '//example.com/a' ]}); is($ng->base_url, $u, 'URL expanded'); my $mid = 'a@b'; - my $mime = Email::MIME->new("Message-ID: <$mid>\r\n\r\n"); + my $mime = PublicInbox::MIME->new("Message-ID: <$mid>\r\n\r\n"); my $hdr = $mime->header_obj; my $mock_self = { nntpd => { grouplist => [], servername => 'example.com' } }; diff --git a/t/nntpd.t b/t/nntpd.t index 5a3a62fbec9c7c13e273d0ee37c2723759fad11c..4993b29fe3f55c38e7f1591d81c942f9ffa68568 100644 --- a/t/nntpd.t +++ b/t/nntpd.t @@ -7,7 +7,7 @@ use PublicInbox::TestCommon; use PublicInbox::Spawn qw(which); require_mods(qw(DBD::SQLite)); require PublicInbox::InboxWritable; -use Email::Simple; +use PublicInbox::MIME; use IO::Socket; use Socket qw(IPPROTO_TCP TCP_NODELAY); use Net::NNTP; @@ -57,7 +57,7 @@ my $im = $ibx->importer; # ensure successful message delivery { - my $mime = Email::MIME->new(<new(< From: =?utf-8?Q?El=C3=A9anor?= Cc: $addr diff --git a/t/nulsubject.t b/t/nulsubject.t index 1ded88d31f435fdad0fa3d792e5079e96ca08ee1..03b1ee80e711d13dbe1000b4f7a9b27b2bc7c202 100644 --- a/t/nulsubject.t +++ b/t/nulsubject.t @@ -14,16 +14,14 @@ { my $git = PublicInbox::Git->new($git_dir); my $im = PublicInbox::Import->new($git, 'testbox', 'test@example'); $im->init_bare; - $im->add(Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'b@example.com', - 'Content-Type' => 'text/plain', - Subject => ' A subject line with a null =?iso-8859-1?q?=00?= see!', - 'Message-ID' => '', - ], - body => "hello world\n", - )); + $im->add(PublicInbox::MIME->new(<<'EOF')); +From: a@example.com +To: b@example.com +Subject: A subject line with a null =?iso-8859-1?q?=00?= see! +Message-ID: + +hello world +EOF $im->done; is(xsys(qw(git --git-dir), $git_dir, 'fsck', '--strict'), 0, 'git fsck ok'); diff --git a/t/plack.t b/t/plack.t index ea31879285fd6d89268677a6eb6941c11fffc6e7..b16bc8de9cd2bbae4d5c73cbcd9d77c98c694fbe 100644 --- a/t/plack.t +++ b/t/plack.t @@ -32,7 +32,7 @@ my $git = PublicInbox::Git->new($inboxdir); my $im = PublicInbox::Import->new($git, 'test', $addr); # ensure successful message delivery { - my $mime = Email::MIME->new(<new(< To: You Cc: $addr @@ -124,7 +124,7 @@ :( EOF $crlf =~ s/\n/\r\n/sg; - $im->add(Email::MIME->new($crlf)); + $im->add(PublicInbox::MIME->new($crlf)); $im->done; } diff --git a/t/psgi_attach.t b/t/psgi_attach.t index a47f37540215a8efabca2d9254a114df5442f016..2376bba7bf2f042e099588da5499429cd679193d 100644 --- a/t/psgi_attach.t +++ b/t/psgi_attach.t @@ -68,7 +68,7 @@ Subject => 'hi'] ); $mime = $mime->as_string; $mime =~ s/\r\n/\n/g; # normalize to LF only - $mime = Email::MIME->new($mime); + $mime = PublicInbox::MIME->new($mime); $im->add($mime); $im->done; diff --git a/t/psgi_mount.t b/t/psgi_mount.t index 3afb1fb59e7251850570729a9c9e9b601983ea6b..bd492dcb2ac372a2aec0720e3caa26339f2a1dae 100644 --- a/t/psgi_mount.t +++ b/t/psgi_mount.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::TestCommon; my ($tmpdir, $for_destroy) = tmpdir(); my $maindir = "$tmpdir/main.git"; @@ -25,7 +25,7 @@ my $git = PublicInbox::Git->new($maindir); my $im = PublicInbox::Import->new($git, 'test', $addr); $im->init_bare; { - my $mime = Email::MIME->new(<new(< To: You Cc: $addr diff --git a/t/psgi_multipart_not.t b/t/psgi_multipart_not.t index 7ef97d438593217a873e2ac6cb03bf340e2cee18..ef86c015f29143a27d45c0d1ac95285788d97406 100644 --- a/t/psgi_multipart_not.t +++ b/t/psgi_multipart_not.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::Config; use PublicInbox::TestCommon; my @mods = qw(DBD::SQLite Search::Xapian HTTP::Request::Common diff --git a/t/psgi_scan_all.t b/t/psgi_scan_all.t index 4d593941a38913d1f3692e19e90977ae94a38645..93603a332819a4a9dc62287ff74a429483762cb3 100644 --- a/t/psgi_scan_all.t +++ b/t/psgi_scan_all.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::Config; use PublicInbox::TestCommon; my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape DBD::SQLite); diff --git a/t/psgi_search.t b/t/psgi_search.t index 4fe315a1e2fdf32db4690699038143c4966a96f4..3c515d19b67a11c218bb6d347eece293d0457fb9 100644 --- a/t/psgi_search.t +++ b/t/psgi_search.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::Config; use PublicInbox::Inbox; use PublicInbox::InboxWritable; diff --git a/t/psgi_text.t b/t/psgi_text.t index 77fc9ee2dac45dd4b1782f962d803d345876e0cf..b7b5b2d456e1580c6576efe8d35175f99a39bdee 100644 --- a/t/psgi_text.t +++ b/t/psgi_text.t @@ -3,7 +3,7 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use PublicInbox::TestCommon; my ($tmpdir, $for_destroy) = tmpdir(); my $maindir = "$tmpdir/main.git"; diff --git a/t/reply.t b/t/reply.t index fbb3e1b807554bcbbe5eb4ae88da60dd76b1459e..a6c38cfaaf2ba97cc4929994b930fbc2bab553cd 100644 --- a/t/reply.t +++ b/t/reply.t @@ -3,7 +3,7 @@ # License: AGPL-3+ use strict; use warnings; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use_ok 'PublicInbox::Reply'; my @q = ( @@ -19,7 +19,7 @@ my $res = PublicInbox::Reply::squote_maybe($input); is($res, $expect, "quote $input => $res"); } -my $mime = Email::MIME->new(<<'EOF'); +my $mime = PublicInbox::MIME->new(<<'EOF'); From: from To: to Cc: cc@example.com diff --git a/t/search-thr-index.t b/t/search-thr-index.t index 6c564b19c0905b07687b8072c586652f5cd78b2f..1bea59fd87ae35c4988f4444fe1ff19cbaff3857 100644 --- a/t/search-thr-index.t +++ b/t/search-thr-index.t @@ -6,7 +6,7 @@ use bytes (); # only for bytes::length use Test::More; use PublicInbox::TestCommon; use PublicInbox::MID qw(mids); -use Email::MIME; +use PublicInbox::MIME; require_mods(qw(DBD::SQLite Search::Xapian)); require PublicInbox::SearchIdx; require PublicInbox::Smsg; @@ -42,7 +42,7 @@ my @mids; foreach (reverse split(/\n\n/, $data)) { $_ .= "\n"; - my $mime = Email::MIME->new(\$_); + my $mime = PublicInbox::MIME->new(\$_); $mime->header_set('From' => 'bw@g'); $mime->header_set('To' => 'git@vger.kernel.org'); my $bytes = bytes::length($mime->as_string); @@ -78,7 +78,7 @@ $rw->commit_txn_lazy; $xdb = $rw->begin_txn_lazy; { - my $mime = Email::MIME->new(<<''); + my $mime = PublicInbox::MIME->new(<<''); Subject: [RFC 00/14] Message-Id: <1-bw@g> From: bw@g diff --git a/t/search.t b/t/search.t index 8508f27301443d28d39a57bd54ed86cd0a38300a..0fd5fdeede0c6521d45cf2af2fad92fd5f3a3f98 100644 --- a/t/search.t +++ b/t/search.t @@ -4,11 +4,11 @@ use strict; use warnings; use Test::More; use PublicInbox::TestCommon; -require_mods(qw(DBD::SQLite Search::Xapian)); +require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); require PublicInbox::SearchIdx; require PublicInbox::Inbox; require PublicInbox::InboxWritable; -use Email::MIME; +use PublicInbox::MIME; my ($tmpdir, $for_destroy) = tmpdir(); my $git_dir = "$tmpdir/a.git"; my $ibx = PublicInbox::Inbox->new({ inboxdir => $git_dir }); @@ -60,27 +60,26 @@ } } $ibx->with_umask(sub { - my $root = Email::MIME->create( - header_str => [ - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - Subject => 'Hello world', - 'Message-ID' => '', - From => 'John Smith ', - To => 'list@example.com', - ], - body => "\\m/\n"); - my $last = Email::MIME->create( - header_str => [ - Date => 'Sat, 02 Oct 2010 00:00:00 +0000', - Subject => 'Re: Hello world', - 'In-Reply-To' => '', - 'Message-ID' => '', - From => 'John Smith ', - To => 'list@example.com', - Cc => 'foo@example.com', - ], - body => "goodbye forever :<\n"); + my $root = PublicInbox::MIME->new(<<'EOF'); +Date: Fri, 02 Oct 1993 00:00:00 +0000 +Subject: Hello world +Message-ID: +From: John Smith +To: list@example.com +\m/ +EOF + my $last = PublicInbox::MIME->new(<<'EOF'); +Date: Sat, 02 Oct 2010 00:00:00 +0000 +Subject: Re: Hello world +In-Reply-To: +Message-ID: +From: John Smith +To: list@example.com +Cc: foo@example.com + +goodbye forever :< +EOF my $rv; $rw_commit->(); $root_id = $rw->add_message($root); @@ -127,31 +126,29 @@ # ghost vivication $ibx->with_umask(sub { $rw_commit->(); my $rmid = ''; - my $reply_to_ghost = Email::MIME->create( - header_str => [ - Date => 'Sat, 02 Oct 2010 00:00:00 +0000', - Subject => 'Re: ghosts', - 'Message-ID' => '', - 'In-Reply-To' => $rmid, - From => 'Time Traveler ', - To => 'list@example.com', - ], - body => "-_-\n"); + my $reply_to_ghost = PublicInbox::MIME->new(<<"EOF"); +Date: Sat, 02 Oct 2010 00:00:00 +0000 +Subject: Re: ghosts +Message-ID: +In-Reply-To: $rmid +From: Time Traveler +To: list\@example.com +-_- +EOF my $rv; my $reply_id = $rw->add_message($reply_to_ghost); is($reply_id, int($reply_id), "reply_id is an integer: $reply_id"); - my $was_ghost = Email::MIME->create( - header_str => [ - Date => 'Sat, 02 Oct 2010 00:00:01 +0000', - Subject => 'ghosts', - 'Message-ID' => $rmid, - From => 'Laggy Sender ', - To => 'list@example.com', - ], - body => "are real\n"); + my $was_ghost = PublicInbox::MIME->new(<<"EOF"); +Date: Sat, 02 Oct 2010 00:00:01 +0000 +Subject: ghosts +Message-ID: $rmid +From: Laggy Sender +To: list\@example.com +are real +EOF my $ghost_id = $rw->add_message($was_ghost); is($ghost_id, int($ghost_id), "ghost_id is an integer: $ghost_id"); my $msgs = $rw->{over}->get_thread('ghost-message@s'); @@ -192,18 +189,17 @@ $ibx->with_umask(sub { $rw_commit->(); $ro->reopen; my $long_mid = 'last' . ('x' x 60). '@s'; + my $long = PublicInbox::MIME->new(< +In-Reply-To: +Message-ID: <$long_mid>, +From: "Long I.D." +To: list\@example.com - my $long = Email::MIME->create( - header_str => [ - Date => 'Sat, 02 Oct 2010 00:00:00 +0000', - Subject => 'long message ID', - 'References' => ' ', - 'In-Reply-To' => '', - 'Message-ID' => "<$long_mid>", - From => '"Long I.D." ', - To => 'list@example.com', - ], - body => "wut\n"); +wut +EOF my $long_id = $rw->add_message($long); is($long_id, int($long_id), "long_id is an integer: $long_id"); @@ -213,18 +209,16 @@ my $res; my @res; my $long_reply_mid = 'reply-to-long@1'; - my $long_reply = Email::MIME->create( - header_str => [ - Subject => 'I break references', - Date => 'Sat, 02 Oct 2010 00:00:00 +0000', - 'Message-ID' => "<$long_reply_mid>", - # No References: - # 'References' => ' <'.$long_mid.'>', - 'In-Reply-To' => "<$long_mid>", - From => 'no1 ', - To => 'list@example.com', - ], - body => "no References\n"); + my $long_reply = PublicInbox::MIME->new(< +In-Reply-To: <$long_mid> +From: no1 +To: list\@example.com + +no References +EOF ok($rw->add_message($long_reply) > $long_id, "inserted long reply"); $rw_commit->(); @@ -239,25 +233,26 @@ # quote prioritization $ibx->with_umask(sub { $rw_commit->(); - $rw->add_message(Email::MIME->create( - header_str => [ - Date => 'Sat, 02 Oct 2010 00:00:01 +0000', - Subject => 'Hello', - 'Message-ID' => '', - From => 'Quoter ', - To => 'list@example.com', - ], - body => "> theatre illusions\nfade\n")); + $rw->add_message(PublicInbox::MIME->new(<<'EOF')); +Date: Sat, 02 Oct 2010 00:00:01 +0000 +Subject: Hello +Message-ID: +From: Quoter +To: list@example.com - $rw->add_message(Email::MIME->create( - header_str => [ - Date => 'Sat, 02 Oct 2010 00:00:02 +0000', - Subject => 'Hello', - 'Message-ID' => '', - From => 'Non-Quoter', - To => 'list@example.com', - ], - body => "theatre\nfade\n")); +> theatre illusions +fade +EOF + $rw->add_message(PublicInbox::MIME->new(<<'EOF')); +Date: Sat, 02 Oct 2010 00:00:02 +0000 +Subject: Hello +Message-ID: +From: Non-Quoter +To: list@example.com + +theatre +fade +EOF my $res = $rw->query("theatre"); is(scalar(@$res), 2, "got both matches"); is($res->[0]->mid, 'nquote@a', "non-quoted scores higher") if scalar(@$res); @@ -272,17 +267,17 @@ # circular references $ibx->with_umask(sub { my $s = 'foo://'. ('Circle' x 15).'/foo'; - my $doc_id = $rw->add_message(Email::MIME->create( - header => [ Subject => $s ], - header_str => [ - Date => 'Sat, 02 Oct 2010 00:00:01 +0000', - 'Message-ID' => '', - 'References' => '', - 'In-Reply-To' => '', - From => 'Circle ', - To => 'list@example.com', - ], - body => "LOOP!\n")); + my $doc_id = $rw->add_message(PublicInbox::MIME->new(< +References: +In-Reply-To: +From: Circle +To: list\@example.com + +LOOP! +EOF ok($doc_id > 0, "doc_id defined with circular reference"); my $smsg = $rw->query('m:circle@a', {limit=>1})->[0]; is(defined($smsg), 1, 'found m:circl@a'); @@ -462,15 +457,13 @@ my $ua = 'Pine.LNX.4.10'; my $mid = "$ua.$digits.2460-100000\@penguin.transmeta.com"; is($ro->reopen->query("m:$digits", { mset => 1})->size, 0, 'no results yet'); - my $pine = Email::MIME->create( - header_str => [ - Subject => 'blah', - 'Message-ID' => "<$mid>", - From => 'torvalds@transmeta', - To => 'list@example.com', - ], - body => "" - ); + my $pine = PublicInbox::MIME->new(< +From: torvalds\@transmeta +To: list\@example.com + +EOF my $x = $rw->add_message($pine); $rw->commit_txn_lazy; is($ro->reopen->query("m:$digits", { mset => 1})->size, 1, diff --git a/t/time.t b/t/time.t index 94bf9181061bbce7d8f41a810a0b394e90af20fe..71600b93b60114e78e1a9debc4f47913881f9c74 100644 --- a/t/time.t +++ b/t/time.t @@ -3,21 +3,20 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; -use_ok 'Email::MIME'; +use POSIX qw(strftime); +use PublicInbox::MIME; use PublicInbox::MsgTime qw(msg_datestamp); -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - 'Message-ID' => '', - Date => 'Fri, 02 Oct 93 00:00:00 +0000', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: b@example.com +Subject: this is a subject +Message-ID: +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +hello world +EOF my $ts = msg_datestamp($mime->header_obj); -use POSIX qw(strftime); is(strftime('%Y-%m-%d %H:%M:%S', gmtime($ts)), '1993-10-02 00:00:00', 'got expected date with 2 digit year'); $mime->header_set(Date => 'Fri, 02 Oct 101 01:02:03 +0000'); diff --git a/t/v1-add-remove-add.t b/t/v1-add-remove-add.t index c3a7e77f18b75607801fd1a8e9de875c942c60b7..23f4fb1181becc7f0a018cba8a5845da585ebc7a 100644 --- a/t/v1-add-remove-add.t +++ b/t/v1-add-remove-add.t @@ -5,7 +5,8 @@ use warnings; use Test::More; use PublicInbox::Import; use PublicInbox::TestCommon; -require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); +use PublicInbox::MIME; +require_mods(qw(DBD::SQLite Search::Xapian)); require PublicInbox::SearchIdx; my ($inboxdir, $for_destroy) = tmpdir(); my $ibx = { @@ -14,16 +15,15 @@ name => 'test-add-remove-add', -primary_address => 'test@example.com', }; $ibx = PublicInbox::Inbox->new($ibx); -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - 'Message-ID' => '', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Message-ID: +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +hello world +EOF my $im = PublicInbox::Import->new($ibx->git, undef, undef, $ibx); $im->init_bare; ok($im->add($mime), 'message added'); diff --git a/t/v1reindex.t b/t/v1reindex.t index ce3833be35696a8d325bf28540a4f2644870ee7e..e473fe7c3942a95f2db6dbca31b10a0d6d733243 100644 --- a/t/v1reindex.t +++ b/t/v1reindex.t @@ -6,8 +6,9 @@ use Test::More; use PublicInbox::ContentId qw(content_digest); use File::Path qw(remove_tree); use PublicInbox::TestCommon; +use PublicInbox::MIME; require_git(2.6); -require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); +require_mods(qw(DBD::SQLite Search::Xapian)); use_ok 'PublicInbox::SearchIdx'; use_ok 'PublicInbox::Import'; my ($inboxdir, $for_destroy) = tmpdir(); @@ -17,15 +18,14 @@ name => 'test-v1reindex', -primary_address => 'test@example.com', indexlevel => 'full', }; -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +hello world +EOF my $minmax; my $msgmap; my ($mark1, $mark2, $mark3, $mark4); diff --git a/t/v2-add-remove-add.t b/t/v2-add-remove-add.t index ca998334ce1a4510cf440c73e2abd18d4ce522a9..60a869eeb9d2462eeafdb21a431b96d27f5541ba 100644 --- a/t/v2-add-remove-add.t +++ b/t/v2-add-remove-add.t @@ -3,9 +3,10 @@ # License: AGPL-3.0+ use strict; use warnings; use Test::More; +use PublicInbox::MIME; use PublicInbox::TestCommon; require_git(2.6); -require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); +require_mods(qw(DBD::SQLite Search::Xapian)); use_ok 'PublicInbox::V2Writable'; my ($inboxdir, $for_destroy) = tmpdir(); my $ibx = { @@ -15,16 +16,15 @@ version => 2, -primary_address => 'test@example.com', }; $ibx = PublicInbox::Inbox->new($ibx); -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - 'Message-ID' => '', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Date: Fri, 02 Oct 1993 00:00:00 +0000 +Message-ID: + +hello world +EOF my $im = PublicInbox::V2Writable->new($ibx, 1); $im->{parallel} = 0; ok($im->add($mime), 'message added'); diff --git a/t/v2mda.t b/t/v2mda.t index 94b63310b5a30bab420eb0cb31ef7c6a91ecde89..4d3ec30db91e4b99ac076826841d53e3e81a2ba0 100644 --- a/t/v2mda.t +++ b/t/v2mda.t @@ -6,10 +6,11 @@ use Test::More; use Fcntl qw(SEEK_SET); use Cwd; use PublicInbox::TestCommon; +use PublicInbox::MIME; require_git(2.6); my $V = 2; -require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); +require_mods(qw(DBD::SQLite Search::Xapian)); use_ok 'PublicInbox::V2Writable'; my ($tmpdir, $for_destroy) = tmpdir(); my $ibx = { @@ -17,18 +18,16 @@ inboxdir => "$tmpdir/inbox", name => 'test-v2writable', address => [ 'test@example.com' ], }; -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - 'Message-ID' => '', - 'List-ID' => '', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Date: Fri, 02 Oct 1993 00:00:00 +0000 +Message-ID: +List-ID: +hello world +EOF my $main_bin = getcwd()."/t/main-bin"; my $fail_bin = getcwd()."/t/fail-bin"; local $ENV{PI_DIR} = "$tmpdir/foo"; diff --git a/t/v2reindex.t b/t/v2reindex.t index 7bf6bc2f935f7f3ce9923d4a7b249b62dc5cb640..b97c6498c27b085c029b792392e10c5181b422a3 100644 --- a/t/v2reindex.t +++ b/t/v2reindex.t @@ -8,7 +8,7 @@ use PublicInbox::ContentId qw(content_digest); use File::Path qw(remove_tree); use PublicInbox::TestCommon; require_git(2.6); -require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); +require_mods(qw(DBD::SQLite Search::Xapian)); use_ok 'PublicInbox::V2Writable'; my ($inboxdir, $for_destroy) = tmpdir(); my $ibx_config = { @@ -24,15 +24,13 @@ local $/; <$fh>; }; my $phrase = q("defending all users' freedom"); -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => $agpl, -); +my $mime = PublicInbox::MIME->new(<<'EOF'.$agpl); +From: a@example.com +To: test@example.com +Subject: this is a subject +Date: Fri, 02 Oct 1993 00:00:00 +0000 + +EOF my $minmax; my $msgmap; my ($mark1, $mark2, $mark3, $mark4); diff --git a/t/v2writable.t b/t/v2writable.t index 7e7560b39b19446378c83baa9142809458e2d877..07687052c0b7fe4f99b9ab1e6fc1442de2e41e81 100644 --- a/t/v2writable.t +++ b/t/v2writable.t @@ -8,7 +8,7 @@ use PublicInbox::ContentId qw(content_digest content_id); use PublicInbox::TestCommon; use Cwd qw(abs_path); require_git(2.6); -require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); +require_mods(qw(DBD::SQLite Search::Xapian)); local $ENV{HOME} = abs_path('t'); use_ok 'PublicInbox::V2Writable'; umask 007; @@ -20,17 +20,15 @@ version => 2, -primary_address => 'test@example.com', }; $ibx = PublicInbox::Inbox->new($ibx); -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - 'Message-ID' => '', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => "hello world\n", -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Message-ID: +Date: Fri, 02 Oct 1993 00:00:00 +0000 +hello world +EOF my $im = PublicInbox::V2Writable->new($ibx, {nproc => 1}); is($im->{shards}, 1, 'one shard when forced'); ok($im->add($mime), 'ordinary message added'); diff --git a/t/watch_maildir.t b/t/watch_maildir.t index 9ed04cab14138ca258e9b6bb325ef0e810f94a44..c34d15f799a6123d2e2429a0ca46d9c0027fbf53 100644 --- a/t/watch_maildir.t +++ b/t/watch_maildir.t @@ -2,7 +2,7 @@ # Copyright (C) 2016-2020 all contributors # License: AGPL-3.0+ use strict; use Test::More; -use Email::MIME; +use PublicInbox::MIME; use Cwd; use PublicInbox::Config; use PublicInbox::TestCommon; diff --git a/t/xcpdb-reshard.t b/t/xcpdb-reshard.t index 2571329e51ec5e89729aefa72212b2c0b48c4e7b..0e1fea52d152a9415f502e97b7aeeae20579d28d 100644 --- a/t/xcpdb-reshard.t +++ b/t/xcpdb-reshard.t @@ -4,22 +4,19 @@ use strict; use warnings; use Test::More; use PublicInbox::TestCommon; -require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); +require_mods(qw(DBD::SQLite Search::Xapian)); require_git('2.6'); use PublicInbox::MIME; use PublicInbox::InboxWritable; require PublicInbox::Search; -my $mime = Email::MIME->create( - header => [ - From => 'a@example.com', - To => 'test@example.com', - Subject => 'this is a subject', - Date => 'Fri, 02 Oct 1993 00:00:00 +0000', - ], - body => '', -); +my $mime = PublicInbox::MIME->new(<<'EOF'); +From: a@example.com +To: test@example.com +Subject: this is a subject +Date: Fri, 02 Oct 1993 00:00:00 +0000 +EOF my ($this) = (split('/', $0))[-1]; my ($tmpdir, $for_destroy) = tmpdir(); local $ENV{PI_CONFIG} = "$tmpdir/config";