From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 4F4FF1F61B for ; Tue, 21 Apr 2020 21:16:15 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] t/*.t: use Email::MIME->create over PublicInbox::MIME->create Date: Tue, 21 Apr 2020 21:16:12 +0000 Message-Id: <20200421211614.5076-3-e@yhbt.net> In-Reply-To: <20200421211614.5076-1-e@yhbt.net> References: <20200421211614.5076-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: PublicInbox::MIME only supports ->new, and is only different from Email::MIME for old versions of Email::MIME. In the future, PublicInbox::MIME may not be a subclass of Email::MIME at all. --- t/convert-compact.t | 4 ++-- t/import.t | 3 ++- t/indexlevels-mirror.t | 4 ++-- t/msgtime.t | 5 +++-- t/psgi_v2.t | 8 ++++---- t/time.t | 4 ++-- t/v1-add-remove-add.t | 5 ++--- t/v1reindex.t | 5 ++--- t/v2-add-remove-add.t | 5 ++--- t/v2mda.t | 5 ++--- t/v2reindex.t | 4 ++-- t/v2writable.t | 4 ++-- t/xcpdb-reshard.t | 4 ++-- 13 files changed, 29 insertions(+), 31 deletions(-) diff --git a/t/convert-compact.t b/t/convert-compact.t index af16b701..376e0f6a 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)); +require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); which('xapian-compact') or plan skip_all => 'xapian-compact missing for '.__FILE__; @@ -26,7 +26,7 @@ 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 = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/import.t b/t/import.t index 79af9846..53345b12 100644 --- a/t/import.t +++ b/t/import.t @@ -10,12 +10,13 @@ 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 = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'b@example.com', diff --git a/t/indexlevels-mirror.t b/t/indexlevels-mirror.t index f2200306..90506e28 100644 --- a/t/indexlevels-mirror.t +++ b/t/indexlevels-mirror.t @@ -10,9 +10,9 @@ 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)); +require_mods(qw(DBD::SQLite Email::MIME)); -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/msgtime.t b/t/msgtime.t index 3f09fb4e..058f3886 100644 --- a/t/msgtime.t +++ b/t/msgtime.t @@ -6,12 +6,13 @@ 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 = PublicInbox::MIME->create( + my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'b@example.com', @@ -34,7 +35,7 @@ EOF sub timestamp ($) { my ($received) = @_; local $SIG{__WARN__} = sub {}; # Suppress warnings - my $mime = PublicInbox::MIME->create( + my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'b@example.com', diff --git a/t/psgi_v2.t b/t/psgi_v2.t index 57017de1..bc26a112 100644 --- a/t/psgi_v2.t +++ b/t/psgi_v2.t @@ -9,7 +9,7 @@ use PublicInbox::MIME; use PublicInbox::Config; use PublicInbox::MID qw(mids); require_mods(qw(DBD::SQLite Search::Xapian HTTP::Request::Common Plack::Test - URI::Escape Plack::Builder)); + URI::Escape Plack::Builder Email::MIME)); use_ok($_) for (qw(HTTP::Request::Common Plack::Test)); use_ok 'PublicInbox::WWW'; use_ok 'PublicInbox::V2Writable'; @@ -226,11 +226,11 @@ test_psgi(sub { $www->call(@_) }, sub { # ensure conflicted attachments can be resolved foreach my $body (qw(old new)) { my $parts = [ - PublicInbox::MIME->create( + Email::MIME->create( attributes => { content_type => 'text/plain' }, body => 'blah', ), - PublicInbox::MIME->create( + Email::MIME->create( attributes => { filename => 'attach.txt', content_type => 'text/plain', @@ -238,7 +238,7 @@ test_psgi(sub { $www->call(@_) }, sub { body => $body ) ]; - $mime = PublicInbox::MIME->create( + $mime = Email::MIME->create( parts => $parts, header_str => [ From => 'root@z', 'Message-ID' => '', diff --git a/t/time.t b/t/time.t index 3cba3bd1..94bf9181 100644 --- a/t/time.t +++ b/t/time.t @@ -3,9 +3,9 @@ use strict; use warnings; use Test::More; -use_ok 'PublicInbox::MIME'; +use_ok 'Email::MIME'; use PublicInbox::MsgTime qw(msg_datestamp); -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/v1-add-remove-add.t b/t/v1-add-remove-add.t index fdf06a96..c3a7e77f 100644 --- a/t/v1-add-remove-add.t +++ b/t/v1-add-remove-add.t @@ -3,10 +3,9 @@ use strict; use warnings; use Test::More; -use PublicInbox::MIME; use PublicInbox::Import; use PublicInbox::TestCommon; -require_mods(qw(DBD::SQLite Search::Xapian)); +require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); require PublicInbox::SearchIdx; my ($inboxdir, $for_destroy) = tmpdir(); my $ibx = { @@ -15,7 +14,7 @@ my $ibx = { -primary_address => 'test@example.com', }; $ibx = PublicInbox::Inbox->new($ibx); -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/v1reindex.t b/t/v1reindex.t index 378c8efb..ce3833be 100644 --- a/t/v1reindex.t +++ b/t/v1reindex.t @@ -3,12 +3,11 @@ use strict; use warnings; use Test::More; -use PublicInbox::MIME; 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)); +require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); use_ok 'PublicInbox::SearchIdx'; use_ok 'PublicInbox::Import'; my ($inboxdir, $for_destroy) = tmpdir(); @@ -18,7 +17,7 @@ my $ibx_config = { -primary_address => 'test@example.com', indexlevel => 'full', }; -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/v2-add-remove-add.t b/t/v2-add-remove-add.t index 328f5326..ca998334 100644 --- a/t/v2-add-remove-add.t +++ b/t/v2-add-remove-add.t @@ -3,10 +3,9 @@ use strict; use warnings; use Test::More; -use PublicInbox::MIME; use PublicInbox::TestCommon; require_git(2.6); -require_mods(qw(DBD::SQLite Search::Xapian)); +require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); use_ok 'PublicInbox::V2Writable'; my ($inboxdir, $for_destroy) = tmpdir(); my $ibx = { @@ -16,7 +15,7 @@ my $ibx = { -primary_address => 'test@example.com', }; $ibx = PublicInbox::Inbox->new($ibx); -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/v2mda.t b/t/v2mda.t index e9dcdf44..94b63310 100644 --- a/t/v2mda.t +++ b/t/v2mda.t @@ -3,14 +3,13 @@ use strict; use warnings; use Test::More; -use PublicInbox::MIME; use Fcntl qw(SEEK_SET); use Cwd; use PublicInbox::TestCommon; require_git(2.6); my $V = 2; -require_mods(qw(DBD::SQLite Search::Xapian)); +require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); use_ok 'PublicInbox::V2Writable'; my ($tmpdir, $for_destroy) = tmpdir(); my $ibx = { @@ -18,7 +17,7 @@ my $ibx = { name => 'test-v2writable', address => [ 'test@example.com' ], }; -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/v2reindex.t b/t/v2reindex.t index b6164ff8..7bf6bc2f 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)); +require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); use_ok 'PublicInbox::V2Writable'; my ($inboxdir, $for_destroy) = tmpdir(); my $ibx_config = { @@ -24,7 +24,7 @@ my $agpl = do { <$fh>; }; my $phrase = q("defending all users' freedom"); -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/v2writable.t b/t/v2writable.t index 8897062a..7e7560b3 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)); +require_mods(qw(DBD::SQLite Search::Xapian Email::MIME)); local $ENV{HOME} = abs_path('t'); use_ok 'PublicInbox::V2Writable'; umask 007; @@ -20,7 +20,7 @@ my $ibx = { -primary_address => 'test@example.com', }; $ibx = PublicInbox::Inbox->new($ibx); -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com', diff --git a/t/xcpdb-reshard.t b/t/xcpdb-reshard.t index 58932fc2..2571329e 100644 --- a/t/xcpdb-reshard.t +++ b/t/xcpdb-reshard.t @@ -4,13 +4,13 @@ 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_git('2.6'); use PublicInbox::MIME; use PublicInbox::InboxWritable; require PublicInbox::Search; -my $mime = PublicInbox::MIME->create( +my $mime = Email::MIME->create( header => [ From => 'a@example.com', To => 'test@example.com',