--- /dev/null
+Return-Path: <tomi.ollila@iki.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 397EC431FAF\r
+ for <notmuch@notmuchmail.org>; Fri, 25 Apr 2014 06:58:03 -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 4Ro395AjkMrC for <notmuch@notmuchmail.org>;\r
+ Fri, 25 Apr 2014 06:57:59 -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 B20BE431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 25 Apr 2014 06:57:58 -0700 (PDT)\r
+Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
+ by guru.guru-group.fi (Postfix) with ESMTP id 32B5D10008C;\r
+ Fri, 25 Apr 2014 16:57:49 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: Austin Clements <amdragon@MIT.EDU>,\r
+ Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH 02/11] test: New tests for Emacs charset handling\r
+In-Reply-To: <20140424182931.GP25817@mit.edu>\r
+References: <1398105468-14317-1-git-send-email-amdragon@mit.edu>\r
+ <1398105468-14317-3-git-send-email-amdragon@mit.edu>\r
+ <87mwfau70e.fsf@qmul.ac.uk> <20140424182931.GP25817@mit.edu>\r
+User-Agent: Notmuch/0.17+201~g56da2d6 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-unknown-linux-gnu)\r
+X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
+ $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
+ !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
+Date: Fri, 25 Apr 2014 16:57:48 +0300\r
+Message-ID: <m2r44lcy03.fsf@guru.guru-group.fi>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+Cc: notmuch@notmuchmail.org\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: Fri, 25 Apr 2014 13:58:03 -0000\r
+\r
+On Thu, Apr 24 2014, Austin Clements <amdragon@MIT.EDU> wrote:\r
+\r
+> Quoth Mark Walters on Apr 24 at 3:38 pm:\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
+> I can reproduce this. Tests that involve HTML rendering are always\r
+> finicky like this since there are so many different HTML renderers.\r
+> Maybe I could normalize the spacing? sed '/^$/d;s/ */ /g' or so?\r
+\r
+\r
+IIRC something was done there to unify renderers...\r
+\r
+id:1336316175-17852-1-git-send-email-awg+notmuch@xvx.ca\r
+\r
+... that (or it's alternative(*) ;) could be made global\r
+\r
+Tomi\r
+\r
+(*) id:m2fwbc4irf.fsf@guru.guru-group.fi\r
+\r
+\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
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r