1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id A1CFF431FBC
\r
6 for <notmuch@notmuchmail.org>; Mon, 21 Apr 2014 11:38:17 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id JaJJ5P7zFyMU for <notmuch@notmuchmail.org>;
\r
16 Mon, 21 Apr 2014 11:38:13 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (dmz-mailsec-scanner-7.mit.edu
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 0A314431FC4
\r
22 for <notmuch@notmuchmail.org>; Mon, 21 Apr 2014 11:38:00 -0700 (PDT)
\r
23 X-AuditID: 12074424-f79e26d000000c70-d5-53556588b234
\r
24 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
25 (using TLS with cipher AES256-SHA (256/256 bits))
\r
26 (Client did not present a certificate)
\r
27 by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP
\r
28 id 70.45.03184.88565535; Mon, 21 Apr 2014 14:38:00 -0400 (EDT)
\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])
\r
30 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id s3LIbuSc022317;
\r
31 Mon, 21 Apr 2014 14:37:57 -0400
\r
32 Received: from drake.dyndns.org
\r
33 (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
34 [216.15.114.40]) (authenticated bits=0)
\r
35 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
36 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s3LIbsGG029710
\r
37 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
38 Mon, 21 Apr 2014 14:37:56 -0400
\r
39 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
40 (envelope-from <amdragon@mit.edu>)
\r
41 id 1WcJ6I-0003ku-BI; Mon, 21 Apr 2014 14:37:54 -0400
\r
42 From: Austin Clements <amdragon@MIT.EDU>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH 02/11] test: New tests for Emacs charset handling
\r
45 Date: Mon, 21 Apr 2014 14:37:39 -0400
\r
46 Message-Id: <1398105468-14317-3-git-send-email-amdragon@mit.edu>
\r
47 X-Mailer: git-send-email 1.9.1
\r
48 In-Reply-To: <1398105468-14317-1-git-send-email-amdragon@mit.edu>
\r
49 References: <1398105468-14317-1-git-send-email-amdragon@mit.edu>
\r
50 X-Brightmail-Tracker:
\r
51 H4sIAAAAAAAAA+NgFtrMIsWRmVeSWpSXmKPExsUixG6nrtuRGhps8PkFm8X1mzOZHRg9nq26
\r
52 xRzAGMVlk5Kak1mWWqRvl8CV8eDjOsaC49oVyztOMDYwblDpYuTkkBAwkWh4t4IdwhaTuHBv
\r
53 PVsXIxeHkMBsJokfcy6yQjgbGSW+zn3PDuHcYZK496ePEcKZyyixtn0dI0g/m4CGxLb9y8Fs
\r
54 EQFpiZ13ZwO1c3AwC6hJ/OkCWycs4CgxY+pzsHUsAqoSH07+YgaxeQUcJI40H2CBOENO4uSx
\r
55 yawgNidQfdvql2D1QkA1G/auYZrAyL+AkWEVo2xKbpVubmJmTnFqsm5xcmJeXmqRrrlebmaJ
\r
56 XmpK6SZGcNi4qOxgbD6kdIhRgINRiYdXwiA0WIg1say4MvcQoyQHk5Io76sooBBfUn5KZUZi
\r
57 cUZ8UWlOavEhRgkOZiUR3vWaQDnelMTKqtSifJiUNAeLkjjvW2urYCGB9MSS1OzU1ILUIpis
\r
58 DAeHkgTvwhSgRsGi1PTUirTMnBKENBMHJ8hwHqDhF0FqeIsLEnOLM9Mh8qcYFaXEedtAEgIg
\r
59 iYzSPLheWFy/YhQHekWYtwWkigeYEuC6XwENZgIa/GRLCMjgkkSElFQD42qpmC/Nff//zhYP
\r
60 X6KVFXfvjkdRQXbtydg/Vm/uv9rmUzpT/fevrU/zQyrWWtTI3G50KVd2Xs65TMRzW3RbnEjK
\r
61 pvp04xfN23oOXjHv3Kc6TeF31JO56w+dv551Zde6iniWNarTvI91VTkbme5YcvTD7TN1h6vz
\r
62 FshetvJ4VnUtRbNKyvuemRJLcUaioRZzUXEiAJByPTnGAgAA
\r
63 X-BeenThere: notmuch@notmuchmail.org
\r
64 X-Mailman-Version: 2.1.13
\r
66 List-Id: "Use and development of the notmuch mail system."
\r
67 <notmuch.notmuchmail.org>
\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
71 List-Post: <mailto:notmuch@notmuchmail.org>
\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
74 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
75 X-List-Received-Date: Mon, 21 Apr 2014 18:38:17 -0000
\r
77 The test of viewing 8bit messages is known-broken. The rest pass, but
\r
78 for very fragile reasons. The next several commits will fix the
\r
79 known-broken test and make our charset handling robust.
\r
81 test/T455-emacs-charsets.sh | 141 ++++++++++++++++++++++++++++++++++++++++++++
\r
82 test/test-lib.el | 4 +-
\r
83 2 files changed, 144 insertions(+), 1 deletion(-)
\r
84 create mode 100755 test/T455-emacs-charsets.sh
\r
86 diff --git a/test/T455-emacs-charsets.sh b/test/T455-emacs-charsets.sh
\r
87 new file mode 100755
\r
88 index 0000000..a42a1d2
\r
90 +++ b/test/T455-emacs-charsets.sh
\r
92 +#!/usr/bin/env bash
\r
94 +test_description="emacs notmuch-show charset handling"
\r
98 +UTF8_YEN=$'\xef\xbf\xa5'
\r
99 +BIG5_YEN=$'\xa2\x44'
\r
101 +# Add four messages with unusual encoding requirements:
\r
103 +# 1) text/plain in quoted-printable big5
\r
104 +generate_message \
\r
105 + [id]=test-plain@example.com \
\r
106 + '[content-type]="text/plain; charset=big5"' \
\r
107 + '[content-transfer-encoding]=quoted-printable' \
\r
108 + '[body]="Yen: =A2=44"'
\r
110 +# 2) text/plain in 8bit big5
\r
111 +generate_message \
\r
112 + [id]=test-plain-8bit@example.com \
\r
113 + '[content-type]="text/plain; charset=big5"' \
\r
114 + '[content-transfer-encoding]=8bit' \
\r
115 + '[body]="Yen: '$BIG5_YEN'"'
\r
117 +# 3) text/html in quoted-printable big5
\r
118 +generate_message \
\r
119 + [id]=test-html@example.com \
\r
120 + '[content-type]="text/html; charset=big5"' \
\r
121 + '[content-transfer-encoding]=quoted-printable' \
\r
122 + '[body]="<html><body>Yen: =A2=44</body></html>"'
\r
124 +# 4) application/octet-stream in quoted-printable of big5 text
\r
125 +generate_message \
\r
126 + [id]=test-binary@example.com \
\r
127 + '[content-type]="application/octet-stream"' \
\r
128 + '[content-transfer-encoding]=quoted-printable' \
\r
129 + '[body]="Yen: =A2=44"'
\r
131 +notmuch new > /dev/null
\r
135 +test_begin_subtest "Text parts are decoded when rendering"
\r
136 +test_emacs '(notmuch-show "id:test-plain@example.com")
\r
137 + (test-visible-output "OUTPUT.raw")'
\r
138 +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT
\r
139 +cat <<EOF >EXPECTED
\r
142 +test_expect_equal_file OUTPUT EXPECTED
\r
144 +test_begin_subtest "8bit text parts are decoded when rendering"
\r
145 +test_emacs '(notmuch-show "id:test-plain-8bit@example.com")
\r
146 + (test-visible-output "OUTPUT.raw")'
\r
147 +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT
\r
148 +cat <<EOF >EXPECTED
\r
151 +test_expect_equal_file OUTPUT EXPECTED
\r
153 +test_begin_subtest "HTML parts are decoded when rendering"
\r
154 +test_emacs '(notmuch-show "id:test-html@example.com")
\r
155 + (test-visible-output "OUTPUT.raw")'
\r
156 +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT
\r
157 +cat <<EOF >EXPECTED
\r
161 +test_expect_equal_file OUTPUT EXPECTED
\r
165 +test_begin_subtest "Text parts are not decoded when saving"
\r
167 +test_emacs '(notmuch-show "id:test-plain@example.com")
\r
168 + (search-forward "Yen")
\r
169 + (let ((standard-input "\"part\""))
\r
170 + (notmuch-show-save-part))'
\r
171 +cat <<EOF >EXPECTED
\r
174 +test_expect_equal_file part EXPECTED
\r
176 +test_begin_subtest "8bit text parts are not decoded when saving"
\r
178 +test_emacs '(notmuch-show "id:test-plain-8bit@example.com")
\r
179 + (search-forward "Yen")
\r
180 + (let ((standard-input "\"part\""))
\r
181 + (notmuch-show-save-part))'
\r
182 +cat <<EOF >EXPECTED
\r
185 +test_expect_equal_file part EXPECTED
\r
187 +test_begin_subtest "HTML parts are not decoded when saving"
\r
189 +test_emacs '(notmuch-show "id:test-html@example.com")
\r
190 + (search-forward "Yen")
\r
191 + (let ((standard-input "\"part\""))
\r
192 + (notmuch-show-save-part))'
\r
193 +cat <<EOF >EXPECTED
\r
194 +<html><body>Yen: $BIG5_YEN</body></html>
\r
196 +test_expect_equal_file part EXPECTED
\r
198 +test_begin_subtest "Binary parts are not decoded when saving"
\r
200 +test_emacs '(notmuch-show "id:test-binary@example.com")
\r
201 + (search-forward "application/")
\r
202 + (let ((standard-input "\"part\""))
\r
203 + (notmuch-show-save-part))'
\r
204 +cat <<EOF >EXPECTED
\r
207 +test_expect_equal_file part EXPECTED
\r
209 +# Test message viewing
\r
211 +test_begin_subtest "Text message are not decoded when viewing"
\r
212 +test_emacs '(notmuch-show "id:test-plain@example.com")
\r
213 + (notmuch-show-view-raw-message)
\r
214 + (test-visible-output "OUTPUT.raw")'
\r
215 +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT
\r
216 +cat <<EOF >EXPECTED
\r
219 +test_expect_equal_file OUTPUT EXPECTED
\r
221 +test_begin_subtest "8bit text message are not decoded when viewing"
\r
222 +test_subtest_known_broken
\r
223 +test_emacs '(notmuch-show "id:test-plain-8bit@example.com")
\r
224 + (notmuch-show-view-raw-message)
\r
225 + (test-visible-output "OUTPUT.raw")'
\r
226 +awk 'show {print} /^$/ {show=1}' < OUTPUT.raw > OUTPUT
\r
227 +cat <<EOF >EXPECTED
\r
230 +test_expect_equal_file OUTPUT EXPECTED
\r
233 diff --git a/test/test-lib.el b/test/test-lib.el
\r
234 index 437f83f..dd3446e 100644
\r
235 --- a/test/test-lib.el
\r
236 +++ b/test/test-lib.el
\r
237 @@ -57,7 +57,9 @@ (defun test-output (&optional filename)
\r
238 (defun test-visible-output (&optional filename)
\r
239 "Save visible text in current buffer to file FILENAME. Default
\r
240 FILENAME is OUTPUT."
\r
241 - (let ((text (visible-buffer-string)))
\r
242 + (let ((text (visible-buffer-string))
\r
243 + ;; Tests expect output in UTF-8 encoding
\r
244 + (coding-system-for-write 'utf-8))
\r
245 (with-temp-file (or filename "OUTPUT") (insert text))))
\r
247 (defun visible-buffer-string ()
\r