Re: notmuch-tree display
[notmuch-archives.git] / ed / fe37d80fab1887b538e12e9de5987fef3c8f01
1 Return-Path: <m.walters@qmul.ac.uk>\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 4992B429E30\r
6         for <notmuch@notmuchmail.org>; Sat, 24 Aug 2013 14:36:20 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id fFE2pZvNGcpk for <notmuch@notmuchmail.org>;\r
17         Sat, 24 Aug 2013 14:36:12 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\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 0B5D4429E2E\r
22         for <notmuch@notmuchmail.org>; Sat, 24 Aug 2013 14:36:12 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1VDLV6-0002zN-0o; Sat, 24 Aug 2013 22:36:06 +0100\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1VDLV5-0008Qc-MR; Sat, 24 Aug 2013 22:36:03 +0100\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Tomi Ollila <tomi.ollila@iki.fi>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH 1/1] test: test notmuch show --include-html option\r
34 In-Reply-To: <1377358170-20561-1-git-send-email-tomi.ollila@iki.fi>\r
35 References: <notmuch-web-1372724382.450184839@www.wuzzeb.org>\r
36         <1377358170-20561-1-git-send-email-tomi.ollila@iki.fi>\r
37 User-Agent: Notmuch/0.15.2+269~g01f5508 (http://notmuchmail.org) Emacs/23.4.1\r
38         (i486-pc-linux-gnu)\r
39 Date: Sat, 24 Aug 2013 22:36:02 +0100\r
40 Message-ID: <877gfa93gd.fsf@qmul.ac.uk>\r
41 MIME-Version: 1.0\r
42 Content-Type: text/plain; charset=us-ascii\r
43 X-Sender-Host-Address: 93.97.24.31\r
44 X-QM-SPAM-Info: Sender has good ham record.  :)\r
45 X-QM-Body-MD5: 7d251aa7bbcf5c7e6d64c69d540f9654 (of first 20000 bytes)\r
46 X-SpamAssassin-Score: 0.0\r
47 X-SpamAssassin-SpamBar: /\r
48 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
49         determine if it is\r
50         spam. We require at least 5.0 points to mark a message as spam.\r
51         This message scored 0.0 points. Summary of the scoring: \r
52         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
53         provider *      (markwalters1009[at]gmail.com)\r
54         *  0.0 AWL AWL: From: address is in the auto white-list\r
55 X-QM-Scan-Virus: ClamAV says the message is clean\r
56 Cc: tomi.ollila@iki.fi\r
57 X-BeenThere: notmuch@notmuchmail.org\r
58 X-Mailman-Version: 2.1.13\r
59 Precedence: list\r
60 List-Id: "Use and development of the notmuch mail system."\r
61         <notmuch.notmuchmail.org>\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
65 List-Post: <mailto:notmuch@notmuchmail.org>\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
68         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
69 X-List-Received-Date: Sat, 24 Aug 2013 21:36:20 -0000\r
70 \r
71 \r
72 Hi\r
73 \r
74 Thanks for this. The pair of patches\r
75 id:notmuch-web-1372724382.450184839@www.wuzzeb.org and\r
76 id:1377358170-20561-1-git-send-email-tomi.ollila@iki.fi LGTM +1\r
77 \r
78 Best wishes\r
79 \r
80 Mark\r
81 \r
82 Tomi Ollila <tomi.ollila@iki.fi> writes:\r
83 \r
84 > Test new --include-html option added to notmuch show command with\r
85 > json output message parts containing text in latin1 and utf8 format.\r
86 > ---\r
87 >\r
88 > this is test for id:notmuch-web-1372724382.450184839@www.wuzzeb.org asked\r
89 > by Mark in id:87txifzexo.fsf@qmul.ac.uk\r
90 >\r
91 >  test/multipart | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-\r
92 >  1 file changed, 81 insertions(+), 1 deletion(-)\r
93 >\r
94 > diff --git a/test/multipart b/test/multipart\r
95 > index 2033023..b40fa2c 100755\r
96 > --- a/test/multipart\r
97 > +++ b/test/multipart\r
98 > @@ -647,4 +647,84 @@ notmuch show --format=raw --part=3 id:base64-part-with-crlf > crlf.out\r
99 >  echo -n -e "\xEF\x0D\x0A" > crlf.expected\r
100 >  test_expect_equal_file crlf.out crlf.expected\r
101 >  \r
102 > -test_done\r
103 > \ No newline at end of file\r
104 > +\r
105 > +# The ISO-8859-1 encoding of U+00BD is a single byte: octal 275\r
106 > +# (Portability note: Dollar-Single ($'...', ANSI C-style escape sequences)\r
107 > +# quoting works on bash, ksh, zsh, *BSD sh but not on dash, ash nor busybox sh)\r
108 > +readonly u_00bd_latin1=$'\275'\r
109 > +\r
110 > +# The Unicode fraction symbol 1/2 is U+00BD and is encoded\r
111 > +# in UTF-8 as two bytes: octal 302 275\r
112 > +readonly u_00bd_utf8=$'\302\275'\r
113 > +\r
114 > +cat <<EOF > ${MAIL_DIR}/include-html\r
115 > +From: A <a@example.com>\r
116 > +To: B <b@example.com>\r
117 > +Subject: html message\r
118 > +Date: Sat, 01 January 2000 00:00:00 +0000\r
119 > +Message-ID: <htmlmessage>\r
120 > +MIME-Version: 1.0\r
121 > +Content-Type: multipart/alternative; boundary="==-=="\r
122 > +\r
123 > +--==-==\r
124 > +Content-Type: text/html; charset=UTF-8\r
125 > +\r
126 > +<p>0.5 equals ${u_00bd_utf8}</p>\r
127 > +\r
128 > +--==-==\r
129 > +Content-Type: text/html; charset=ISO-8859-1\r
130 > +\r
131 > +<p>0.5 equals ${u_00bd_latin1}</p>\r
132 > +\r
133 > +--==-==\r
134 > +Content-Type: text/plain; charset=UTF-8\r
135 > +\r
136 > +0.5 equals ${u_00bd_utf8}\r
137 > +\r
138 > +--==-==--\r
139 > +EOF\r
140 > +\r
141 > +notmuch new > /dev/null\r
142 > +\r
143 > +cat_expected_head ()\r
144 > +{\r
145 > +        cat <<EOF\r
146 > +[[[{"id": "htmlmessage", "match":true, "excluded": false, "date_relative":"2000-01-01",\r
147 > +   "timestamp": 946684800,\r
148 > +   "filename": "${MAIL_DIR}/include-html",\r
149 > +   "tags": ["inbox", "unread"],\r
150 > +   "headers": { "Date": "Sat, 01 Jan 2000 00:00:00 +0000", "From": "A <a@example.com>",\r
151 > +                "Subject": "html message", "To": "B <b@example.com>"},\r
152 > +   "body": [{\r
153 > +     "content-type": "multipart/alternative", "id": 1,\r
154 > +EOF\r
155 > +}\r
156 > +\r
157 > +cat_expected_head > EXPECTED.nohtml\r
158 > +cat <<EOF >> EXPECTED.nohtml\r
159 > +"content": [\r
160 > +  { "id": 2, "content-charset": "UTF-8", "content-length": 21, "content-type": "text/html"},\r
161 > +  { "id": 3, "content-charset": "ISO-8859-1", "content-length": 20, "content-type": "text/html"},\r
162 > +  { "id": 4, "content-type": "text/plain", "content": "0.5 equals \\u00bd\\n"}\r
163 > +]}]},[]]]]\r
164 > +EOF\r
165 > +\r
166 > +# Both the UTF-8 and ISO-8859-1 part should have U+00BD\r
167 > +cat_expected_head > EXPECTED.withhtml\r
168 > +cat <<EOF >> EXPECTED.withhtml\r
169 > +"content": [\r
170 > +  { "id": 2, "content-type": "text/html", "content": "<p>0.5 equals \\u00bd</p>\\n"},\r
171 > +  { "id": 3, "content-type": "text/html", "content": "<p>0.5 equals \\u00bd</p>\\n"},\r
172 > +  { "id": 4, "content-type": "text/plain", "content": "0.5 equals \\u00bd\\n"}\r
173 > +]}]},[]]]]\r
174 > +EOF\r
175 > +\r
176 > +test_begin_subtest "html parts excluded by default"\r
177 > +notmuch show --format=json id:htmlmessage > OUTPUT\r
178 > +test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.nohtml)"\r
179 > +\r
180 > +test_begin_subtest "html parts included"\r
181 > +notmuch show --format=json --include-html id:htmlmessage > OUTPUT\r
182 > +test_expect_equal_json "$(cat OUTPUT)" "$(cat EXPECTED.withhtml)"\r
183 > +\r
184 > +test_done\r
185 > -- \r
186 > 1.8.0\r
187 >\r
188 > _______________________________________________\r
189 > notmuch mailing list\r
190 > notmuch@notmuchmail.org\r
191 > http://notmuchmail.org/mailman/listinfo/notmuch\r