about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-04-25 05:52:23 +0000
committerEric Wong <e@yhbt.net>2020-04-26 07:03:15 +0000
commitaa454143b1f26ffdf5f32f17c2032473d70eceae (patch)
tree5dec11537d4ee9e3ed2c0ecfb86112251024116d /t
parente39585ee2bdcbeaab7b6bd33b3568021042d0879 (diff)
downloadpublic-inbox-aa454143b1f26ffdf5f32f17c2032473d70eceae.tar.gz
mime_from_path is designed to fail gracefully in busy Maildirs
whereas mime_load was made for loading files from a work tree.
Diffstat (limited to 't')
-rw-r--r--t/mda.t4
-rw-r--r--t/msg_iter.t9
-rw-r--r--t/nntpd-tls.t4
-rw-r--r--t/search.t4
-rw-r--r--t/solver_git.t4
5 files changed, 6 insertions, 19 deletions
diff --git a/t/mda.t b/t/mda.t
index 863eaf8f..03cc4bc3 100644
--- a/t/mda.t
+++ b/t/mda.t
@@ -62,9 +62,7 @@ local $ENV{GIT_COMMITTER_NAME} = eval {
         use PublicInbox::MDA;
         use PublicInbox::Address;
         use Encode qw/encode/;
-        my $eml = 't/utf8.eml';
-        my $msg = PublicInbox::InboxWritable::mime_from_path($eml) or
-                die "failed to open $eml: $!";
+        my $msg = mime_load 't/utf8.eml';
         my $from = $msg->header('From');
         my ($author) = PublicInbox::Address::names($from);
         my ($email) = PublicInbox::Address::emails($from);
diff --git a/t/msg_iter.t b/t/msg_iter.t
index 6adbf165..5c57e043 100644
--- a/t/msg_iter.t
+++ b/t/msg_iter.t
@@ -5,7 +5,6 @@ use warnings;
 use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::Hval qw(ascii_html);
-use PublicInbox::InboxWritable;
 use_ok('PublicInbox::MsgIter');
 
 {
@@ -34,9 +33,7 @@ use_ok('PublicInbox::MsgIter');
 }
 
 {
-        my $f = 't/iso-2202-jp.eml';
-        my $mime = PublicInbox::InboxWritable::mime_from_path($f) or
-                die "open $f: $!";
+        my $mime = mime_load 't/iso-2202-jp.eml';
         my $raw = '';
         msg_iter($mime, sub {
                 my ($part, $level, @ex) = @{$_[0]};
@@ -49,9 +46,7 @@ use_ok('PublicInbox::MsgIter');
 }
 
 {
-        my $f = 't/x-unknown-alpine.eml';
-        my $mime = PublicInbox::InboxWritable::mime_from_path($f) or
-                die "open $f: $!";
+        my $mime = mime_load 't/x-unknown-alpine.eml';
         my $raw = '';
         msg_iter($mime, sub {
                 my ($part, $level, @ex) = @{$_[0]};
diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t
index a0522e1f..0ad29be0 100644
--- a/t/nntpd-tls.t
+++ b/t/nntpd-tls.t
@@ -63,9 +63,7 @@ EOF
 
 {
         my $im = $ibx->importer(0);
-        my $eml = 't/data/0001.patch';
-        my $mime = PublicInbox::InboxWritable::mime_from_path($eml) or
-                die "open $eml: $!";
+        my $mime = mime_load 't/data/0001.patch';
         ok($im->add($mime), 'message added');
         $im->done;
         if ($version == 1) {
diff --git a/t/search.t b/t/search.t
index 40264345..83986837 100644
--- a/t/search.t
+++ b/t/search.t
@@ -286,9 +286,7 @@ EOF
 });
 
 $ibx->with_umask(sub {
-        my $eml = 't/utf8.eml';
-        my $mime = PublicInbox::InboxWritable::mime_from_path($eml) or
-                die "open $eml: $!";
+        my $mime = mime_load 't/utf8.eml';
         my $doc_id = $rw->add_message($mime);
         ok($doc_id > 0, 'message indexed doc_id with UTF-8');
         my $msg = $rw->query('m:testmessage@example.com', {limit => 1})->[0];
diff --git a/t/solver_git.t b/t/solver_git.t
index 7f79ff4c..c483aba1 100644
--- a/t/solver_git.t
+++ b/t/solver_git.t
@@ -29,9 +29,7 @@ my $im = PublicInbox::V2Writable->new($ibx, 1);
 $im->{parallel} = 0;
 
 my $deliver_patch = sub ($) {
-        my $mime = PublicInbox::InboxWritable::mime_from_path($_[0]) or
-                die "open $_[0]: $!";
-        $im->add($mime);
+        $im->add(mime_load($_[0]));
         $im->done;
 };