]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/mda.t
imaptracker: preserve WAL journal_mode if set by user
[public-inbox.git] / t / mda.t
diff --git a/t/mda.t b/t/mda.t
index 863eaf8fe2dda3d3316b84ddb3737b379efebcce..c7caf3e0cca455e3eb40088492b62f26f167ecc4 100644 (file)
--- 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 = eml_load 't/utf8.eml';
        my $from = $msg->header('From');
        my ($author) = PublicInbox::Address::names($from);
        my ($email) = PublicInbox::Address::emails($from);
@@ -231,7 +229,7 @@ EOF
                "learned ham idempotently ");
 
        # ensure trained email is filtered, too
-       my $mime = mime_load 't/mda-mime.eml';
+       my $mime = eml_load 't/mda-mime.eml';
        ($mid) = ($mime->header_raw('message-id') =~ /<([^>]+)>/);
        {
                $in = $mime->as_string;
@@ -301,9 +299,17 @@ EOF
        ok(run_script(['-mda'], undef, $rdr),
                'mda OK with multiple List-Id matches');
        $cur = $git->qx(qw(diff HEAD~1..HEAD));
-       like($cur, qr/Message-ID: <2lids\@example>/,
+       like($cur, qr/^\+Message-ID: <2lids\@example>/sm,
                'multi List-ID match delivered');
        like($err, qr/multiple List-ID/, 'warned about multiple List-ID');
+
+       # ensure -learn rm works after inbox address is updated
+       ($out, $err) = ('', '');
+       xsys(qw(git config --file), $pi_config, "$cfgpfx.address",
+               'updated-address@example.com');
+       ok(run_script(['-learn', 'rm'], undef, $rdr), 'rm-ed via -learn');
+       $cur = $git->qx(qw(diff HEAD~1..HEAD));
+       like($cur, qr/^-Message-ID: <2lids\@example>/sm, 'changed in git');
 }
 
 done_testing();