[PATCH 2/2] Add additional munged reply-to tests

Daniel Kahn Gillmor dkg at fifthhorseman.net
Fri Jul 14 06:09:12 PDT 2017


The reply-to munging code might behave differently whether there's an
exact match on the strings or not, or whether the string is a raw
addr-spec instead of an name-addr.  These tests cover those variations
(i also had to tweak json output further below when this new test was
added).
---
 test/T220-reply.sh | 38 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index b12109bf..7da16583 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -126,6 +126,42 @@ References: <${gen_msg_id}>
 On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender at example.com> wrote:
 > Un-munging Reply-To"
 
+test_begin_subtest "Un-munging Reply-To With Exact Match"
+add_message '[from]="Sender <sender at example.com>"' \
+	    '[to]="Some List <list at example.com>"' \
+	     [subject]=notmuch-reply-test \
+	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+	    '[body]="Un-munging Reply-To"' \
+	    '[reply-to]="Some List <list at example.com>"'
+
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite at notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender at example.com>, Some List <list at example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender at example.com> wrote:
+> Un-munging Reply-To"
+
+test_begin_subtest "Un-munging Reply-To With Raw addr-spec"
+add_message '[from]="Sender <sender at example.com>"' \
+	    '[to]="Some List <list at example.com>"' \
+	     [subject]=notmuch-reply-test \
+	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
+	    '[body]="Un-munging Reply-To"' \
+	    '[reply-to]="list at example.com"'
+
+output=$(notmuch reply id:${gen_msg_id} || echo failed)
+test_expect_equal "$output" "From: Notmuch Test Suite <test_suite at notmuchmail.org>
+Subject: Re: notmuch-reply-test
+To: Sender <sender at example.com>, Some List <list at example.com>
+In-Reply-To: <${gen_msg_id}>
+References: <${gen_msg_id}>
+
+On Tue, 05 Jan 2010 15:43:56 -0000, Sender <sender at example.com> wrote:
+> Un-munging Reply-To"
+
 test_begin_subtest "Message with header of exactly 200 bytes"
 add_message '[subject]="This subject is exactly 200 bytes in length. Other than its length there is not much of note here. Note that the length of 200 bytes includes the Subject: and Re: prefixes with two spaces"' \
 	    '[date]="Tue, 05 Jan 2010 15:43:56 -0000"' \
@@ -229,7 +265,7 @@ test_expect_equal_json "$output" '
         ],
         "date_relative": "2010-01-05",
         "excluded": false,
-        "filename": ["'${MAIL_DIR}'/msg-012"],
+        "filename": ["'${MAIL_DIR}'/msg-014"],
         "headers": {
             "Date": "Tue, 05 Jan 2010 15:43:56 +0000",
             "From": "\u2603 <snowman at example.com>",
-- 
2.13.2



More information about the notmuch mailing list