]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/edit.t
update copyrights for 2021
[public-inbox.git] / t / edit.t
index 1a5698f69231232f5783cbc606f814ed00ff355f..0d57e6298d0521060c4f8ac3565959513ce3242e 100644 (file)
--- a/t/edit.t
+++ b/t/edit.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2019-2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2019-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 # edit frontend behavior test (t/replace.t for backend)
 use strict;
@@ -24,11 +24,9 @@ my $ibx = PublicInbox::Inbox->new({
 $ibx = PublicInbox::InboxWritable->new($ibx, {nproc=>1});
 my $cfgfile = "$tmpdir/config";
 local $ENV{PI_CONFIG} = $cfgfile;
-my $file = 't/data/0001.patch';
-open my $fh, '<', $file or die "open: $!";
-my $raw = do { local $/; <$fh> };
 my $im = $ibx->importer(0);
-my $mime = PublicInbox::Eml->new($raw);
+my $file = 't/data/0001.patch';
+my $mime = eml_load($file);
 my $mid = mid_clean($mime->header('Message-Id'));
 ok($im->add($mime), 'add message to be edited');
 $im->done;
@@ -43,7 +41,7 @@ $t = '-F FILE'; {
        ok(run_script($cmd, undef, $opt), "$t edit OK");
        $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        like($cur->header('Subject'), qr/bool pfx/, "$t message edited");
-       like($out, qr/[a-f0-9]{40}/, "$t shows commit on success");
+       like($out, qr/[a-f0-9]{40,}/, "$t shows commit on success");
 }
 
 $t = '-m MESSAGE_ID'; {
@@ -53,7 +51,7 @@ $t = '-m MESSAGE_ID'; {
        ok(run_script($cmd, undef, $opt), "$t edit OK");
        $cur = PublicInbox::Eml->new($ibx->msg_by_mid($mid));
        like($cur->header('Subject'), qr/boolean prefix/, "$t message edited");
-       like($out, qr/[a-f0-9]{40}/, "$t shows commit on success");
+       like($out, qr/[a-f0-9]{40,}/, "$t shows commit on success");
 }
 
 $t = 'no-op -m MESSAGE_ID'; {