[PATCH v2 4/8] show: Unify JSON header output for messages and message parts
authorAustin Clements <amdragon@MIT.EDU>
Mon, 20 Feb 2012 00:26:26 +0000 (19:26 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:44 +0000 (09:44 -0800)
c4/7cfe6e4b8b91c5fef64a338753c60f30182bce [new file with mode: 0644]

diff --git a/c4/7cfe6e4b8b91c5fef64a338753c60f30182bce b/c4/7cfe6e4b8b91c5fef64a338753c60f30182bce
new file mode 100644 (file)
index 0000000..f07cb56
--- /dev/null
@@ -0,0 +1,324 @@
+Return-Path: <amthrax@drake.mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A9C91431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 16:26:46 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id NrhqZWEpbVuw for <notmuch@notmuchmail.org>;\r
+       Sun, 19 Feb 2012 16:26:42 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
+       [18.7.68.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id E51B8431FC9\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 16:26:36 -0800 (PST)\r
+X-AuditID: 12074422-b7fd66d0000008f9-c4-4f41933cae99\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 90.06.02297.C33914F4; Sun, 19 Feb 2012 19:26:36 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q1K0QakW024839; \r
+       Sun, 19 Feb 2012 19:26:36 -0500\r
+Received: from drake.mit.edu\r
+       (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [209.6.116.242]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1K0QYbI000309\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sun, 19 Feb 2012 19:26:35 -0500 (EST)\r
+Received: from amthrax by drake.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amthrax@drake.mit.edu>)\r
+       id 1RzH5N-0001yL-Lt; Sun, 19 Feb 2012 19:26:33 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject:\r
+ [PATCH v2 4/8] show: Unify JSON header output for messages and message parts\r
+Date: Sun, 19 Feb 2012 19:26:26 -0500\r
+Message-Id: <1329697590-7404-5-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To: <1329697590-7404-1-git-send-email-amdragon@mit.edu>\r
+References: <1329240823-7856-1-git-send-email-amdragon@mit.edu>\r
+       <1329697590-7404-1-git-send-email-amdragon@mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFuphleLIzCtJLcpLzFFi42IR4hTV1rWZ7OhvsKJD1+L6zZnMFm9WzmN1\r
+       YPI4/HUhi8ezVbeYA5iiuGxSUnMyy1KL9O0SuDI+dgUUHEmvOPEuuoHxZUQXIyeHhICJxNOr\r
+       s1ggbDGJC/fWs3UxcnEICexjlHi4/gArhLOBUeJX9y0mCOc+k8TiPUtZIJz5jBK/f35gBeln\r
+       E9CQ2LZ/OSOILSIgLbHz7mywOLOAlcThq5vAbGGBeon/azcA1XBwsAioSpxcYQgS5hWwl3j0\r
+       5yMTxBkKEudWn2MHKeEUcJBYvcMVJCwkUCpx5MkWJohyQYmTM5+wgJQwC6hLrJ8nBLFIXqJ5\r
+       62zmCYxCs5BUzUKomoWkagEj8ypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdU73czBK91JTSTYyg\r
+       gGZ3UdrB+POg0iFGAQ5GJR5eyTIHfyHWxLLiytxDjJIcTEqivKcmOPoL8SXlp1RmJBZnxBeV\r
+       5qQWH2KU4GBWEuFdYA+U401JrKxKLcqHSUlzsCiJ86prvfMTEkhPLEnNTk0tSC2CycpwcChJ\r
+       8O6aBNQoWJSanlqRlplTgpBm4uAEGc4DNPwaSA1vcUFibnFmOkT+FKMux4FPzy8wCrHk5eel\r
+       Sonz7gcpEgApyijNg5sDS0SvGMWB3hLmTQOp4gEmMbhJr4CWMAEt4RWyA1lSkoiQkmpgVE7e\r
+       5z5hX19j49kYzddTuT9mb3jYd6lg2w+76PYQ2XrVXzNPfU9sdUmpfBeus7niptfvhZqdiip2\r
+       +7S2/5JkUGCdmnLp8mn2Dbks13Na/jOlzF2le4v/faDKquJd12bu7+wUclX6KvEgNvSBdser\r
+       g/stjpoGpM64Munt1fvMuS8v/4lmSzohqMRSnJFoqMVcVJwIANSSrb4fAwAA\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 20 Feb 2012 00:26:47 -0000\r
+\r
+This has three ramifications:\r
+- Blank To and Cc headers are no longer output for messages.\r
+- Dates are now canonicalized for messages, which means they always\r
+  have a day of the week and GMT is printed +0000 (never -0000)\r
+- Invalid From message headers are handled slightly differently, since\r
+  they get parsed by GMime now instead of notmuch.\r
+---\r
+ notmuch-show.c    |   35 +++--------------------------------\r
+ test/crypto       |   35 ++++++++++++++---------------------\r
+ test/emacs        |    4 ++--\r
+ test/json         |    6 +++---\r
+ test/maildir-sync |    2 --\r
+ test/multipart    |    2 +-\r
+ 6 files changed, 23 insertions(+), 61 deletions(-)\r
+\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index 9ca9882..209ff45 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -291,36 +291,7 @@ format_headers_message_part_text (GMimeMessage *message)\r
+ }\r
+ \r
+ static void\r
+-format_headers_json (const void *ctx, notmuch_message_t *message)\r
+-{\r
+-    const char *headers[] = {\r
+-      "Subject", "From", "To", "Cc", "Bcc", "Date"\r
+-    };\r
+-    const char *name, *value;\r
+-    unsigned int i;\r
+-    int first_header = 1;\r
+-    void *ctx_quote = talloc_new (ctx);\r
+-\r
+-    for (i = 0; i < ARRAY_SIZE (headers); i++) {\r
+-      name = headers[i];\r
+-      value = notmuch_message_get_header (message, name);\r
+-      if (value)\r
+-      {\r
+-          if (!first_header)\r
+-              fputs (", ", stdout);\r
+-          first_header = 0;\r
+-\r
+-          printf ("%s: %s",\r
+-                  json_quote_str (ctx_quote, name),\r
+-                  json_quote_str (ctx_quote, value));\r
+-      }\r
+-    }\r
+-\r
+-    talloc_free (ctx_quote);\r
+-}\r
+-\r
+-static void\r
+-format_headers_message_part_json (GMimeMessage *message)\r
++format_headers_json (GMimeMessage *message)\r
+ {\r
+     void *ctx = talloc_new (NULL);\r
+     void *ctx_quote = talloc_new (ctx);\r
+@@ -690,7 +661,7 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first)\r
+       format_message_json (ctx, node->envelope_file);\r
+ \r
+       printf ("\"headers\": {");\r
+-      format_headers_json (ctx, node->envelope_file);\r
++      format_headers_json (GMIME_MESSAGE (node->part));\r
+       printf ("}");\r
+ \r
+       printf (", \"body\": [");\r
+@@ -778,7 +749,7 @@ format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t first)\r
+ \r
+     if (GMIME_IS_MESSAGE (node->part)) {\r
+       printf ("\"headers\": {");\r
+-      format_headers_message_part_json (GMIME_MESSAGE (node->part));\r
++      format_headers_json (GMIME_MESSAGE (node->part));\r
+       printf ("}");\r
+ \r
+       printf (", \"body\": [");\r
+diff --git a/test/crypto b/test/crypto\r
+index 1dbb60a..7e774c8 100755\r
+--- a/test/crypto\r
++++ b/test/crypto\r
+@@ -50,9 +50,8 @@ expected='[[[{"id": "XXXXX",\r
+  "headers": {"Subject": "test signed message 001",\r
+  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+  "To": "test_suite@notmuchmail.org",\r
+- "Cc": "",\r
+- "Bcc": "",\r
+- "Date": "01 Jan 2000 12:00:00 -0000"},\r
++ "Date": "Sat,\r
++ 01 Jan 2000 12:00:00 +0000"},\r
+  "body": [{"id": 1,\r
+  "sigstatus": [{"status": "good",\r
+  "fingerprint": "'$FINGERPRINT'",\r
+@@ -84,9 +83,8 @@ expected='[[[{"id": "XXXXX",\r
+  "headers": {"Subject": "test signed message 001",\r
+  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+  "To": "test_suite@notmuchmail.org",\r
+- "Cc": "",\r
+- "Bcc": "",\r
+- "Date": "01 Jan 2000 12:00:00 -0000"},\r
++ "Date": "Sat,\r
++ 01 Jan 2000 12:00:00 +0000"},\r
+  "body": [{"id": 1,\r
+  "sigstatus": [{"status": "good",\r
+  "fingerprint": "'$FINGERPRINT'",\r
+@@ -120,9 +118,8 @@ expected='[[[{"id": "XXXXX",\r
+  "headers": {"Subject": "test signed message 001",\r
+  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+  "To": "test_suite@notmuchmail.org",\r
+- "Cc": "",\r
+- "Bcc": "",\r
+- "Date": "01 Jan 2000 12:00:00 -0000"},\r
++ "Date": "Sat,\r
++ 01 Jan 2000 12:00:00 +0000"},\r
+  "body": [{"id": 1,\r
+  "sigstatus": [{"status": "error",\r
+  "keyid": "'$(echo $FINGERPRINT | cut -c 25-)'",\r
+@@ -194,9 +191,8 @@ expected='[[[{"id": "XXXXX",\r
+  "headers": {"Subject": "test encrypted message 001",\r
+  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+  "To": "test_suite@notmuchmail.org",\r
+- "Cc": "",\r
+- "Bcc": "",\r
+- "Date": "01 Jan 2000 12:00:00 -0000"},\r
++ "Date": "Sat,\r
++ 01 Jan 2000 12:00:00 +0000"},\r
+  "body": [{"id": 1,\r
+  "encstatus": [{"status": "good"}],\r
+  "sigstatus": [],\r
+@@ -249,9 +245,8 @@ expected='[[[{"id": "XXXXX",\r
+  "headers": {"Subject": "test encrypted message 001",\r
+  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+  "To": "test_suite@notmuchmail.org",\r
+- "Cc": "",\r
+- "Bcc": "",\r
+- "Date": "01 Jan 2000 12:00:00 -0000"},\r
++ "Date": "Sat,\r
++ 01 Jan 2000 12:00:00 +0000"},\r
+  "body": [{"id": 1,\r
+  "encstatus": [{"status": "bad"}],\r
+  "content-type": "multipart/encrypted",\r
+@@ -284,9 +279,8 @@ expected='[[[{"id": "XXXXX",\r
+  "headers": {"Subject": "test encrypted message 002",\r
+  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+  "To": "test_suite@notmuchmail.org",\r
+- "Cc": "",\r
+- "Bcc": "",\r
+- "Date": "01 Jan 2000 12:00:00 -0000"},\r
++ "Date": "Sat,\r
++ 01 Jan 2000 12:00:00 +0000"},\r
+  "body": [{"id": 1,\r
+  "encstatus": [{"status": "good"}],\r
+  "sigstatus": [{"status": "good",\r
+@@ -339,9 +333,8 @@ expected='[[[{"id": "XXXXX",\r
+  "headers": {"Subject": "test signed message 001",\r
+  "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+  "To": "test_suite@notmuchmail.org",\r
+- "Cc": "",\r
+- "Bcc": "",\r
+- "Date": "01 Jan 2000 12:00:00 -0000"},\r
++ "Date": "Sat,\r
++ 01 Jan 2000 12:00:00 +0000"},\r
+  "body": [{"id": 1,\r
+  "sigstatus": [{"status": "error",\r
+  "keyid": "6D92612D94E46381",\r
+diff --git a/test/emacs b/test/emacs\r
+index b74cfa9..d4a8d30 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -78,7 +78,7 @@ thread=$(notmuch search --output=threads subject:message-with-invalid-from)\r
+ test_emacs "(notmuch-show \"$thread\")\r
+           (test-output)"\r
+ cat <<EOF >EXPECTED\r
+-Invalid " From <test_suite@notmuchmail.org> (2001-01-05) (inbox)\r
++"Invalid " (2001-01-05) (inbox)\r
+ Subject: message-with-invalid-from\r
+ To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
+ Date: Fri, 05 Jan 2001 15:43:57 +0000\r
+@@ -411,7 +411,7 @@ test_emacs '(notmuch-show "id:\"bought\"")\r
+       (reverse-region (point-min) (point-max))\r
+           (test-output)'\r
+ cat <<EOF >EXPECTED\r
+-Sat, 01 Jan 2000 12:00:00 -0000\r
++Sat, 01 Jan 2000 12:00:00 +0000\r
+ Some One <someone@somewhere.org>\r
+ Some One Else <notsomeone@somewhere.org>\r
+ Notmuch <notmuch@notmuchmail.org>\r
+diff --git a/test/json b/test/json\r
+index 7df4380..1bdffd2 100755\r
+--- a/test/json\r
++++ b/test/json\r
+@@ -5,7 +5,7 @@ test_description="--format=json output"\r
+ test_begin_subtest "Show message: json"\r
+ add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-show-message\""\r
+ output=$(notmuch show --format=json "json-show-message")\r
+-test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
++test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"json-show-message\n\"}]}, []]]]"\r
+ \r
+ test_begin_subtest "Search message: json"\r
+ add_message "[subject]=\"json-search-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"json-search-message\""\r
+@@ -22,7 +22,7 @@ test_expect_equal "$output" "[{\"thread\": \"XXX\",\r
+ test_begin_subtest "Show message: json, utf-8"\r
+ add_message "[subject]=\"json-show-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-show-méssage\""\r
+ output=$(notmuch show --format=json "jsön-show-méssage")\r
+-test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"\r
++test_expect_equal "$output" "[[[{\"id\": \"${gen_msg_id}\", \"match\": true, \"filename\": \"${gen_msg_filename}\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\",\"unread\"], \"headers\": {\"Subject\": \"json-show-utf8-body-sübjéct\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"text/plain\", \"content\": \"jsön-show-méssage\n\"}]}, []]]]"\r
+ \r
+ test_begin_subtest "Show message: json, inline attachment filename"\r
+ subject='json-show-inline-attachment-filename'\r
+@@ -35,7 +35,7 @@ emacs_deliver_message \\r
+      (insert \"Message-ID: <$id>\n\")"\r
+ output=$(notmuch show --format=json "id:$id")\r
+ filename=$(notmuch search --output=files "id:$id")\r
+-test_expect_equal "$output" "[[[{\"id\": \"$id\", \"match\": true, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"test_suite@notmuchmail.org\", \"Cc\": \"\", \"Bcc\": \"\", \"Date\": \"01 Jan 2000 12:00:00 -0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"filename\": \"README\"}]}]}, []]]]"\r
++test_expect_equal "$output" "[[[{\"id\": \"$id\", \"match\": true, \"filename\": \"$filename\", \"timestamp\": 946728000, \"date_relative\": \"2000-01-01\", \"tags\": [\"inbox\"], \"headers\": {\"Subject\": \"$subject\", \"From\": \"Notmuch Test Suite <test_suite@notmuchmail.org>\", \"To\": \"test_suite@notmuchmail.org\", \"Date\": \"Sat, 01 Jan 2000 12:00:00 +0000\"}, \"body\": [{\"id\": 1, \"content-type\": \"multipart/mixed\", \"content\": [{\"id\": 2, \"content-type\": \"text/plain\", \"content\": \"This is a test message with inline attachment with a filename\"}, {\"id\": 3, \"content-type\": \"application/octet-stream\", \"filename\": \"README\"}]}]}, []]]]"\r
+ \r
+ test_begin_subtest "Search message: json, utf-8"\r
+ add_message "[subject]=\"json-search-utf8-body-sübjéct\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"jsön-search-méssage\""\r
+diff --git a/test/maildir-sync b/test/maildir-sync\r
+index d5872a5..1ee2db0 100755\r
+--- a/test/maildir-sync\r
++++ b/test/maildir-sync\r
+@@ -53,8 +53,6 @@ test_expect_equal "$output" '[[[{"id": "adding-replied-tag@notmuch-test-suite",\r
+ "headers": {"Subject": "Adding replied tag",\r
+ "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+ "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
+-"Cc": "",\r
+-"Bcc": "",\r
+ "Date": "Fri,\r
+ 05 Jan 2001 15:43:57 +0000"},\r
+ "body": [{"id": 1,\r
+diff --git a/test/multipart b/test/multipart\r
+index 4d14804..a3036b4 100755\r
+--- a/test/multipart\r
++++ b/test/multipart\r
+@@ -322,7 +322,7 @@ notmuch show --format=json --part=0 'id:87liy5ap00.fsf@yoom.home.cworth.org' | s\r
+ echo >>OUTPUT # expect *no* newline at end of output\r
+ cat <<EOF >EXPECTED\r
+ \r
+-{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Cc": "", "Bcc": "", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [\r
++{"id": "87liy5ap00.fsf@yoom.home.cworth.org", "match": true, "filename": "${MAIL_DIR}/multipart", "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["attachment","inbox","signed","unread"], "headers": {"Subject": "Multipart message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [\r
+ {"id": 1, "content-type": "multipart/signed", "content": [\r
+ {"id": 2, "content-type": "multipart/mixed", "content": [\r
+ {"id": 3, "content-type": "message/rfc822", "content": [{"headers": {"Subject": "html message", "From": "Carl Worth <cworth@cworth.org>", "To": "cworth@cworth.org", "Date": "Fri, 05 Jan 2001 15:42:57 +0000"}, "body": [\r
+-- \r
+1.7.7.3\r
+\r