--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 02C3A431FAF\r
+ for <notmuch@notmuchmail.org>; Thu, 24 Apr 2014 07:39:12 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.502\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.502 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, 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 0w2N8wlcK4Xi for <notmuch@notmuchmail.org>;\r
+ Thu, 24 Apr 2014 07:39:06 -0700 (PDT)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 5E5B1431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 24 Apr 2014 07:39:06 -0700 (PDT)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WdKnj-0005aX-Fu; Thu, 24 Apr 2014 15:39:02 +0100\r
+Received: from 5751dfa2.skybroadband.com ([87.81.223.162] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WdKni-00061H-St; Thu, 24 Apr 2014 15:38:59 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 02/11] test: New tests for Emacs charset handling\r
+In-Reply-To: <1398105468-14317-3-git-send-email-amdragon@mit.edu>\r
+References: <1398105468-14317-1-git-send-email-amdragon@mit.edu>\r
+ <1398105468-14317-3-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Thu, 24 Apr 2014 15:38:57 +0100\r
+Message-ID: <87mwfau70e.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 87.81.223.162\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 49fbe5710ce73b4679e68641e94890fd (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Thu, 24 Apr 2014 14:39:12 -0000\r
+\r
+\r
+On Mon, 21 Apr 2014, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> The test of viewing 8bit messages is known-broken. The rest pass, but\r
+> for very fragile reasons. The next several commits will fix the\r
+> known-broken test and make our charset handling robust.\r
+\r
+Hi \r
+\r
+On one of my systems one of these (non-broken) tests fails. I am not\r
+sure whether I messed up my emacs/environment when doing stuff remotely\r
+recently so it could just be my system\r
+\r
+\r
+> ---\r
+> test/T455-emacs-charsets.sh | 141 ++++++++++++++++++++++++++++++++++++++++++++\r
+> test/test-lib.el | 4 +-\r
+> 2 files changed, 144 insertions(+), 1 deletion(-)\r
+> create mode 100755 test/T455-emacs-charsets.sh\r
+>\r
+> diff --git a/test/T455-emacs-charsets.sh b/test/T455-emacs-charsets.sh\r
+> new file mode 100755\r
+> index 0000000..a42a1d2\r
+> --- /dev/null\r
+> +++ b/test/T455-emacs-charsets.sh\r
+> @@ -0,0 +1,141 @@\r
+> +#!/usr/bin/env bash\r
+> +\r
+> +test_description="emacs notmuch-show charset handling"\r
+> +. ./test-lib.sh\r
+> +\r
+> +\r
+> +UTF8_YEN=$'\xef\xbf\xa5'\r
+> +BIG5_YEN=$'\xa2\x44'\r
+> +\r
+> +# Add four messages with unusual encoding requirements:\r
+> +#\r
+> +# 1) text/plain in quoted-printable big5\r
+> +generate_message \\r
+> + [id]=test-plain@example.com \\r
+> + '[content-type]="text/plain; charset=big5"' \\r
+> + '[content-transfer-encoding]=quoted-printable' \\r
+> + '[body]="Yen: =A2=44"'\r
+> +\r
+> +# 2) text/plain in 8bit big5\r
+> +generate_message \\r
+> + [id]=test-plain-8bit@example.com \\r
+> + '[content-type]="text/plain; charset=big5"' \\r
+> + '[content-transfer-encoding]=8bit' \\r
+> + '[body]="Yen: '$BIG5_YEN'"'\r
+> +\r
+> +# 3) text/html in quoted-printable big5\r
+> +generate_message \\r
+> + [id]=test-html@example.com \\r
+> + '[content-type]="text/html; charset=big5"' \\r
+> + '[content-transfer-encoding]=quoted-printable' \\r
+> + '[body]="<html><body>Yen: =A2=44</body></html>"'\r
+> +\r
+> +# 4) application/octet-stream in quoted-printable of big5 text\r
+> +generate_message \\r
+> + [id]=test-binary@example.com \\r
+> + '[content-type]="application/octet-stream"' \\r
+> + '[content-transfer-encoding]=quoted-printable' \\r
+> + '[body]="Yen: =A2=44"'\r
+> +\r
+> +notmuch new > /dev/null\r
+> +\r
+> +# Test rendering\r
+> +\r
+> +test_begin_subtest "Text parts are decoded when rendering"\r
+> +test_emacs '(notmuch-show "id:test-plain@example.com")\r
+> + (test-visible-output "OUTPUT.raw")'\r
+> +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT\r
+> +cat <<EOF >EXPECTED\r
+> +Yen: $UTF8_YEN\r
+> +EOF\r
+> +test_expect_equal_file OUTPUT EXPECTED\r
+> +\r
+> +test_begin_subtest "8bit text parts are decoded when rendering"\r
+> +test_emacs '(notmuch-show "id:test-plain-8bit@example.com")\r
+> + (test-visible-output "OUTPUT.raw")'\r
+> +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT\r
+> +cat <<EOF >EXPECTED\r
+> +Yen: $UTF8_YEN\r
+> +EOF\r
+> +test_expect_equal_file OUTPUT EXPECTED\r
+> +\r
+> +test_begin_subtest "HTML parts are decoded when rendering"\r
+> +test_emacs '(notmuch-show "id:test-html@example.com")\r
+> + (test-visible-output "OUTPUT.raw")'\r
+> +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT\r
+> +cat <<EOF >EXPECTED\r
+> +[ text/html ]\r
+> +Yen: $UTF8_YEN\r
+> +EOF\r
+> +test_expect_equal_file OUTPUT EXPECTED\r
+\r
+It's this test: I get an extra newline after the UFT8_YEN. \r
+\r
+This is with emacs 23.4.1 on a Debian wheezy(ish) system.\r
+\r
+But as said it could be my fault: I think some odd things happened when\r
+I tried to install emacs 24 and 23 simultaneously to help testing\r
+things.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+> +\r
+> +# Test saving\r
+> +\r
+> +test_begin_subtest "Text parts are not decoded when saving"\r
+> +rm -f part\r
+> +test_emacs '(notmuch-show "id:test-plain@example.com")\r
+> + (search-forward "Yen")\r
+> + (let ((standard-input "\"part\""))\r
+> + (notmuch-show-save-part))'\r
+> +cat <<EOF >EXPECTED\r
+> +Yen: $BIG5_YEN\r
+> +EOF\r
+> +test_expect_equal_file part EXPECTED\r
+> +\r
+> +test_begin_subtest "8bit text parts are not decoded when saving"\r
+> +rm -f part\r
+> +test_emacs '(notmuch-show "id:test-plain-8bit@example.com")\r
+> + (search-forward "Yen")\r
+> + (let ((standard-input "\"part\""))\r
+> + (notmuch-show-save-part))'\r
+> +cat <<EOF >EXPECTED\r
+> +Yen: $BIG5_YEN\r
+> +EOF\r
+> +test_expect_equal_file part EXPECTED\r
+> +\r
+> +test_begin_subtest "HTML parts are not decoded when saving"\r
+> +rm -f part\r
+> +test_emacs '(notmuch-show "id:test-html@example.com")\r
+> + (search-forward "Yen")\r
+> + (let ((standard-input "\"part\""))\r
+> + (notmuch-show-save-part))'\r
+> +cat <<EOF >EXPECTED\r
+> +<html><body>Yen: $BIG5_YEN</body></html>\r
+> +EOF\r
+> +test_expect_equal_file part EXPECTED\r
+> +\r
+> +test_begin_subtest "Binary parts are not decoded when saving"\r
+> +rm -f part\r
+> +test_emacs '(notmuch-show "id:test-binary@example.com")\r
+> + (search-forward "application/")\r
+> + (let ((standard-input "\"part\""))\r
+> + (notmuch-show-save-part))'\r
+> +cat <<EOF >EXPECTED\r
+> +Yen: $BIG5_YEN\r
+> +EOF\r
+> +test_expect_equal_file part EXPECTED\r
+> +\r
+> +# Test message viewing\r
+> +\r
+> +test_begin_subtest "Text message are not decoded when viewing"\r
+> +test_emacs '(notmuch-show "id:test-plain@example.com")\r
+> + (notmuch-show-view-raw-message)\r
+> + (test-visible-output "OUTPUT.raw")'\r
+> +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT\r
+> +cat <<EOF >EXPECTED\r
+> +Yen: =A2=44\r
+> +EOF\r
+> +test_expect_equal_file OUTPUT EXPECTED\r
+> +\r
+> +test_begin_subtest "8bit text message are not decoded when viewing"\r
+> +test_subtest_known_broken\r
+> +test_emacs '(notmuch-show "id:test-plain-8bit@example.com")\r
+> + (notmuch-show-view-raw-message)\r
+> + (test-visible-output "OUTPUT.raw")'\r
+> +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT\r
+> +cat <<EOF >EXPECTED\r
+> +Yen: $BIG5_YEN\r
+> +EOF\r
+> +test_expect_equal_file OUTPUT EXPECTED\r
+> +\r
+> +test_done\r
+> diff --git a/test/test-lib.el b/test/test-lib.el\r
+> index 437f83f..dd3446e 100644\r
+> --- a/test/test-lib.el\r
+> +++ b/test/test-lib.el\r
+> @@ -57,7 +57,9 @@ (defun test-output (&optional filename)\r
+> (defun test-visible-output (&optional filename)\r
+> "Save visible text in current buffer to file FILENAME. Default\r
+> FILENAME is OUTPUT."\r
+> - (let ((text (visible-buffer-string)))\r
+> + (let ((text (visible-buffer-string))\r
+> + ;; Tests expect output in UTF-8 encoding\r
+> + (coding-system-for-write 'utf-8))\r
+> (with-temp-file (or filename "OUTPUT") (insert text))))\r
+> \r
+> (defun visible-buffer-string ()\r
+> -- \r
+> 1.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r