Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 14 / 3dfa66903c7f12de10444a08d0ec46ac3a3193
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 2238F431FBD\r
6         for <notmuch@notmuchmail.org>; Wed,  8 Aug 2012 08:46:13 -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: -0.7\r
10 X-Spam-Level: \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 EPk1K47ghroK for <notmuch@notmuchmail.org>;\r
16         Wed,  8 Aug 2012 08:46:12 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id 19199431FAE\r
20         for <notmuch@notmuchmail.org>; Wed,  8 Aug 2012 08:46:12 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7f306d0000008b4-51-502289c3e2eb\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 06.15.02228.3C982205; Wed,  8 Aug 2012 11:46:11 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q78FkAjX011907; \r
27         Wed, 8 Aug 2012 11:46:11 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q78Fk9l8018579\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Wed, 8 Aug 2012 11:46:10 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1Sz8SW-0006ZA-Se; Wed, 08 Aug 2012 11:46:08 -0400\r
37 Date: Wed, 8 Aug 2012 11:46:08 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Tomi Ollila <tomi.ollila@iki.fi>\r
40 Subject: Re: [PATCH v2] test: Add test for messages with missing headers\r
41 Message-ID: <20120808154608.GD11179@mit.edu>\r
42 References: <1344374501-28185-1-git-send-email-amdragon@mit.edu>\r
43         <1344389313-7886-1-git-send-email-amdragon@mit.edu>\r
44         <m2k3x9olfl.fsf@guru.guru-group.fi>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 Content-Disposition: inline\r
48 In-Reply-To: <m2k3x9olfl.fsf@guru.guru-group.fi>\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IR4hRV1j3cqRRg8HuVhsX1mzOZLd6snMfq\r
52         wORx+OtCFo9nq24xBzBFcdmkpOZklqUW6dslcGV8mTuHsWCuTcWPSZuYGxgPaHQxcnJICJhI\r
53         PJ74iRHCFpO4cG89WxcjF4eQwD5Gia5PGxkhnPWMEq82f4RyTjBJTJq+mAXCWcIoseJzN3MX\r
54         IwcHi4CKxNf/7CCj2AQ0JLbtXw42VgQo/KBtPSuIzSwgLfHtdzMTiC0s4CHx4O18sDivgI7E\r
55         vCtrWCFmzmGU+L+jnR0iIShxcuYTFohmLYkb/14ygewCGbT8HwdImFPAQKLl4UewmaJAu6ac\r
56         3MY2gVFoFpLuWUi6ZyF0L2BkXsUom5JbpZubmJlTnJqsW5ycmJeXWqRropebWaKXmlK6iREc\r
57         2JL8Oxi/HVQ6xCjAwajEwxudrBggxJpYVlyZe4hRkoNJSZTXsk0pQIgvKT+lMiOxOCO+qDQn\r
58         tfgQowQHs5II79tgoBxvSmJlVWpRPkxKmoNFSZz3aspNfyGB9MSS1OzU1ILUIpisDAeHkgSv\r
59         NzCChQSLUtNTK9Iyc0oQ0kwcnCDDeYCGb+0AGV5ckJhbnJkOkT/FqCglzssB0iwAksgozYPr\r
60         hSWeV4ziQK8I8zKDVPEAkxZc9yugwUxAgw+Lgg0uSURISTUwqu5OsubWEL/J/+FsjcYig7xZ\r
61         /2RZ/ZpEPY5cls403LX4tNai4zPKF/3lzn8k+dRGIuMTc1GZ/4JjSiU+P99XCEY/tMn/z/rc\r
62         T6z38NuHi188y7j9p6BOikGEV7ckWFj7MIejY/SbZXwNaUnB92vb9KZHzBXavMfzteBSnh2P\r
63         jfc13poYVC6rxFKckWioxVxUnAgAg5y81hcDAAA=\r
64 Cc: notmuch@notmuchmail.org\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Wed, 08 Aug 2012 15:46:13 -0000\r
78 \r
79 Quoth Tomi Ollila on Aug 08 at 11:08 am:\r
80 > On Wed, Aug 08 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
81\r
82 > > Currently the JSON tests for search and show are broken because\r
83 > > notmuch attempts to dereference a NULL pointer.\r
84 > > ---\r
85 > > This version fixes the "Show: text" test so that it sanitize its\r
86 > > output and doesn't hard-code my test paths.\r
87\r
88 > +1\r
89\r
90 > Tomi\r
91\r
92 > w/ python json(.tool) the original order cannot be preserved as the parser\r
93 > stores content into dictionary -- without sorting those came in some\r
94 > internal python order... the following code could be used to use less\r
95 \r
96 To be fair, it can output them in original order, but doing so\r
97 requires Python 2.7:\r
98 \r
99 python -c 'import sys,json,collections; json.dump(json.load(sys.stdin, object_pairs_hook=collections.OrderedDict), sys.stdout, indent=4)'\r
100 \r
101 > indentation, though:\r
102\r
103 > python -c 'import sys,json; j = json.load(sys.stdin);\r
104 > json.dump(j, sys.stdout, sort_keys=True, indent=2)' < input_file\r
105\r
106 > The other "problem" with json.tool is that it converts non-ascii chars\r
107 > to \uNNNN values :/.\r
108 \r
109 This one doesn't require 2.7.\r
110 \r
111 python -c 'import sys,json,codecs; json.dump(json.load(sys.stdin), codecs.getwriter("utf8")(sys.stdout), indent=4, ensure_ascii=False)'\r
112 \r
113 Though I think that, for test canonicalization, \uNNNN is probably\r
114 less error/locale prone.\r
115 \r
116 > What we could do is to dig a simple c json formatter -- someday in the\r
117 > future, maybe -- but for *now* this is the best we can have :D\r
118 \r
119 Not another JSON parser/printer!\r
120 \r
121 > >\r
122 > >  test/missing-headers |  162 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
123 > >  test/notmuch-test    |    1 +\r
124 > >  2 files changed, 163 insertions(+)\r
125 > >  create mode 100755 test/missing-headers\r
126 > >\r
127 > > diff --git a/test/missing-headers b/test/missing-headers\r
128 > > new file mode 100755\r
129 > > index 0000000..e79f922\r
130 > > --- /dev/null\r
131 > > +++ b/test/missing-headers\r
132 > > @@ -0,0 +1,162 @@\r
133 > > +#!/usr/bin/env bash\r
134 > > +test_description='messages with missing headers'\r
135 > > +. ./test-lib.sh\r
136 > > +\r
137 > > +# Notmuch requires at least one of from, subject, or to or it will\r
138 > > +# ignore the file.  Generate two messages so that together they cover\r
139 > > +# all possible missing headers.  We also give one of the messages a\r
140 > > +# date to ensure stable result ordering.\r
141 > > +\r
142 > > +cat <<EOF > "${MAIL_DIR}/msg-2"\r
143 > > +To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
144 > > +Date: Fri, 05 Jan 2001 15:43:57 +0000\r
145 > > +\r
146 > > +Body\r
147 > > +EOF\r
148 > > +\r
149 > > +cat <<EOF > "${MAIL_DIR}/msg-1"\r
150 > > +From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
151 > > +\r
152 > > +Body\r
153 > > +EOF\r
154 > > +\r
155 > > +NOTMUCH_NEW\r
156 > > +\r
157 > > +test_begin_subtest "Search: text"\r
158 > > +output=$(notmuch search '*' | notmuch_search_sanitize)\r
159 > > +test_expect_equal "$output" "\\r
160 > > +thread:XXX   2001-01-05 [1/1] (null);  (inbox unread)\r
161 > > +thread:XXX   1970-01-01 [1/1] Notmuch Test Suite;  (inbox unread)"\r
162 > > +\r
163 > > +test_begin_subtest "Search: json"\r
164 > > +test_subtest_known_broken\r
165 > > +output=$(notmuch search --format=json '*' | notmuch_search_sanitize)\r
166 > > +test_expect_equal_json "$output" '\r
167 > > +[\r
168 > > +    {\r
169 > > +        "authors": "",\r
170 > > +        "date_relative": "2001-01-05",\r
171 > > +        "matched": 1,\r
172 > > +        "subject": "",\r
173 > > +        "tags": [\r
174 > > +            "inbox",\r
175 > > +            "unread"\r
176 > > +        ],\r
177 > > +        "thread": "XXX",\r
178 > > +        "timestamp": 978709437,\r
179 > > +        "total": 1\r
180 > > +    },\r
181 > > +    {\r
182 > > +        "authors": "Notmuch Test Suite",\r
183 > > +        "date_relative": "1970-01-01",\r
184 > > +        "matched": 1,\r
185 > > +        "subject": "",\r
186 > > +        "tags": [\r
187 > > +            "inbox",\r
188 > > +            "unread"\r
189 > > +        ],\r
190 > > +        "thread": "XXX",\r
191 > > +        "timestamp": 0,\r
192 > > +        "total": 1\r
193 > > +    }\r
194 > > +]'\r
195 > > +\r
196 > > +test_begin_subtest "Show: text"\r
197 > > +output=$(notmuch show '*' | notmuch_show_sanitize)\r
198 > > +test_expect_equal "$output" "\\r
199 > > +\f\r
200 message{ id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-2\r
201 > > +\f\r
202 header{\r
203 > > + (2001-01-05) (inbox unread)\r
204 > > +Subject: (null)\r
205 > > +From: (null)\r
206 > > +To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
207 > > +Date: Fri, 05 Jan 2001 15:43:57 +0000\r
208 > > +\f\r
209 header}\r
210 > > +\f\r
211 body{\r
212 > > +\f\r
213 part{ ID: 1, Content-type: text/plain\r
214 > > +Body\r
215 > > +\f\r
216 part}\r
217 > > +\f\r
218 body}\r
219 > > +\f\r
220 message}\r
221 > > +\f\r
222 message{ id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-1\r
223 > > +\f\r
224 header{\r
225 > > +Notmuch Test Suite <test_suite@notmuchmail.org> (1970-01-01) (inbox unread)\r
226 > > +Subject: (null)\r
227 > > +From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
228 > > +Date: Thu, 01 Jan 1970 00:00:00 +0000\r
229 > > +\f\r
230 header}\r
231 > > +\f\r
232 body{\r
233 > > +\f\r
234 part{ ID: 1, Content-type: text/plain\r
235 > > +Body\r
236 > > +\f\r
237 part}\r
238 > > +\f\r
239 body}\r
240 > > +\f\r
241 message}"\r
242 > > +\r
243 > > +test_begin_subtest "Show: json"\r
244 > > +test_subtest_known_broken\r
245 > > +output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)\r
246 > > +test_expect_equal_json "$output" '\r
247 > > +[\r
248 > > +    [\r
249 > > +        [\r
250 > > +            {\r
251 > > +                "body": [\r
252 > > +                    {\r
253 > > +                        "content": "Body\n",\r
254 > > +                        "content-type": "text/plain",\r
255 > > +                        "id": 1\r
256 > > +                    }\r
257 > > +                ],\r
258 > > +                "date_relative": "2001-01-05",\r
259 > > +                "excluded": false,\r
260 > > +                "filename": "YYYYY",\r
261 > > +                "headers": {\r
262 > > +                    "Date": "Fri, 05 Jan 2001 15:43:57 +0000",\r
263 > > +                    "From": "",\r
264 > > +                    "Subject": "",\r
265 > > +                    "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"\r
266 > > +                },\r
267 > > +                "id": "XXXXX",\r
268 > > +                "match": true,\r
269 > > +                "tags": [\r
270 > > +                    "inbox",\r
271 > > +                    "unread"\r
272 > > +                ],\r
273 > > +                "timestamp": 978709437\r
274 > > +            },\r
275 > > +            []\r
276 > > +        ]\r
277 > > +    ],\r
278 > > +    [\r
279 > > +        [\r
280 > > +            {\r
281 > > +                "body": [\r
282 > > +                    {\r
283 > > +                        "content": "Body\n",\r
284 > > +                        "content-type": "text/plain",\r
285 > > +                        "id": 1\r
286 > > +                    }\r
287 > > +                ],\r
288 > > +                "date_relative": "1970-01-01",\r
289 > > +                "excluded": false,\r
290 > > +                "filename": "YYYYY",\r
291 > > +                "headers": {\r
292 > > +                    "Date": "Thu, 01 Jan 1970 00:00:00 +0000",\r
293 > > +                    "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
294 > > +                    "Subject": ""\r
295 > > +                },\r
296 > > +                "id": "XXXXX",\r
297 > > +                "match": true,\r
298 > > +                "tags": [\r
299 > > +                    "inbox",\r
300 > > +                    "unread"\r
301 > > +                ],\r
302 > > +                "timestamp": 0\r
303 > > +            },\r
304 > > +            []\r
305 > > +        ]\r
306 > > +    ]\r
307 > > +]'\r
308 > > +\r
309 > > +\r
310 > > +test_done\r
311 > > diff --git a/test/notmuch-test b/test/notmuch-test\r
312 > > index ea39dfc..cc732c3 100755\r
313 > > --- a/test/notmuch-test\r
314 > > +++ b/test/notmuch-test\r
315 > > @@ -59,6 +59,7 @@ TESTS="\r
316 > >    emacs-address-cleaning\r
317 > >    emacs-hello\r
318 > >    emacs-show\r
319 > > +  missing-headers\r
320 > >  "\r
321 > >  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
322 > >  \r
323 > >\r
324 > > _______________________________________________\r
325 > > notmuch mailing list\r
326 > > notmuch@notmuchmail.org\r
327 > > http://notmuchmail.org/mailman/listinfo/notmuch\r