about summary refs log tree commit
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-21 21:16:12 +0000
committerEric Wong <e@yhbt.net>2020-04-22 18:22:40 +0000
commit62d1a4da996bd9a664be954f71f78fe052f9df16 (patch)
tree3fc45fcaccfc149b13fc6b7688017cb176852f25
parent4bd22e9528484c5d964ecba277fd6a7d5e023461 (diff)
downloadpublic-inbox-62d1a4da996bd9a664be954f71f78fe052f9df16.tar.gz
t/*.t: use Email::MIME->create over PublicInbox::MIME->create
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.
-rw-r--r--t/convert-compact.t4
-rw-r--r--t/import.t3
-rw-r--r--t/indexlevels-mirror.t4
-rw-r--r--t/msgtime.t5
-rw-r--r--t/psgi_v2.t8
-rw-r--r--t/time.t4
-rw-r--r--t/v1-add-remove-add.t5
-rw-r--r--t/v1reindex.t5
-rw-r--r--t/v2-add-remove-add.t5
-rw-r--r--t/v2mda.t5
-rw-r--r--t/v2reindex.t4
-rw-r--r--t/v2writable.t4
-rw-r--r--t/xcpdb-reshard.t4
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' => '<a@dup>',
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',