--- /dev/null
+Return-Path: <too@guru-group.fi>\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 3B784431E62\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Aug 2013 08:29:46 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 VHFk471qFlIN for <notmuch@notmuchmail.org>;\r
+ Sat, 24 Aug 2013 08:29:41 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id A2BF1431FBD\r
+ for <notmuch@notmuchmail.org>; Sat, 24 Aug 2013 08:29:41 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+ id 70D1410009D; Sat, 24 Aug 2013 18:29:32 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/1] test: test notmuch show --include-html option\r
+Date: Sat, 24 Aug 2013 18:29:30 +0300\r
+Message-Id: <1377358170-20561-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.8.0\r
+In-Reply-To: <notmuch-web-1372724382.450184839@www.wuzzeb.org>\r
+References: <notmuch-web-1372724382.450184839@www.wuzzeb.org>\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: Sat, 24 Aug 2013 15:29:46 -0000\r
+\r
+Test new --include-html option added to notmuch show command with\r
+json output message parts containing text in latin1 and utf8 format.\r
+---\r
+\r
+this is test for id:notmuch-web-1372724382.450184839@www.wuzzeb.org asked\r
+by Mark in id:87txifzexo.fsf@qmul.ac.uk\r
+\r
+ test/multipart | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-\r
+ 1 file changed, 81 insertions(+), 1 deletion(-)\r
+\r
+diff --git a/test/multipart b/test/multipart\r
+index 2033023..b40fa2c 100755\r
+--- a/test/multipart\r
++++ b/test/multipart\r
+@@ -647,4 +647,84 @@ notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out\r
+ echo -n -e "\xEF\x0D\x0A" > crlf.expected\r
+ test_expect_equal_file crlf.out crlf.expected\r
+ \r
+-test_done\r
+\ No newline at end of file\r
++\r
++# The ISO-8859-1 encoding of U+00BD is a single byte: octal 275\r
++# (Portability note: Dollar-Single ($'...', ANSI C-style escape sequences)\r
++# quoting works on bash, ksh, zsh, *BSD sh but not on dash, ash nor busybox sh)\r
++readonly u_00bd_latin1=$'\275'\r
++\r
++# The Unicode fraction symbol 1/2 is U+00BD and is encoded\r
++# in UTF-8 as two bytes: octal 302 275\r
++readonly u_00bd_utf8=$'\302\275'\r
++\r
++cat <<EOF > ${MAIL_DIR}/include-html\r
++From: A <a@example.com>\r
++To: B <b@example.com>\r
++Subject: html message\r
++Date: Sat, 01 January 2000 00:00:00 +0000\r
++Message-ID: <htmlmessage>\r
++MIME-Version: 1.0\r
++Content-Type: multipart/alternative; boundary="==-=="\r
++\r
++--==-==\r
++Content-Type: text/html; charset=UTF-8\r
++\r
++<p>0.5 equals ${u_00bd_utf8}</p>\r
++\r
++--==-==\r
++Content-Type: text/html; charset=ISO-8859-1\r
++\r
++<p>0.5 equals ${u_00bd_latin1}</p>\r
++\r
++--==-==\r
++Content-Type: text/plain; charset=UTF-8\r
++\r
++0.5 equals ${u_00bd_utf8}\r
++\r
++--==-==--\r
++EOF\r
++\r
++notmuch new > /dev/null\r
++\r
++cat_expected_head ()\r
++{\r
++ cat <<EOF\r
++[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",\r
++ "timestamp": 946684800,\r
++ "filename": "${MAIL_DIR}/include-html",\r
++ "tags": ["inbox", "unread"],\r
++ "headers": { "Date": "Sat, 01 Jan 2000 00:00:00 +0000", "From": "A <a@example.com>",\r
++ "Subject": "html message", "To": "B <b@example.com>"},\r
++ "body": [{\r
++ "content-type": "multipart/alternative", "id": 1,\r
++EOF\r
++}\r
++\r
++cat_expected_head > EXPECTED.nohtml\r
++cat <<EOF >> EXPECTED.nohtml\r
++"content": [\r
++ { "id": 2, "content-charset": "UTF-8", "content-length": 21, "content-type": "text/html"},\r
++ { "id": 3, "content-charset": "ISO-8859-1", "content-length": 20, "content-type": "text/html"},\r
++ { "id": 4, "content-type": "text/plain", "content": "0.5 equals \\u00bd\\n"}\r
++]}]},[]]]]\r
++EOF\r
++\r
++# Both the UTF-8 and ISO-8859-1 part should have U+00BD\r
++cat_expected_head > EXPECTED.withhtml\r
++cat <<EOF >> EXPECTED.withhtml\r
++"content": [\r
++ { "id": 2, "content-type": "text/html", "content": "<p>0.5 equals \\u00bd</p>\\n"},\r
++ { "id": 3, "content-type": "text/html", "content": "<p>0.5 equals \\u00bd</p>\\n"},\r
++ { "id": 4, "content-type": "text/plain", "content": "0.5 equals \\u00bd\\n"}\r
++]}]},[]]]]\r
++EOF\r
++\r
++test_begin_subtest "html parts excluded by default"\r
++notmuch show --format=json id:htmlmessage > OUTPUT\r
++test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.nohtml)"\r
++\r
++test_begin_subtest "html parts included"\r
++notmuch show --format=json --include-html id:htmlmessage > OUTPUT\r
++test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)"\r
++\r
++test_done\r
+-- \r
+1.8.0\r
+\r