Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / c9 / aae14c9b4839091f646e8bdf2ed5ec08e06eab
1 Return-Path: <tomi.ollila@iki.fi>\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 7A54C431FAF\r
6         for <notmuch@notmuchmail.org>; Wed,  8 Aug 2012 01:08:23 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 E0psDqnw9rW3 for <notmuch@notmuchmail.org>;\r
16         Wed,  8 Aug 2012 01:08:21 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 1D841431FAE\r
19         for <notmuch@notmuchmail.org>; Wed,  8 Aug 2012 01:08:21 -0700 (PDT)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id 01E6B1002A4; Wed,  8 Aug 2012 11:08:31 +0300 (EEST)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
24 Subject: Re: [PATCH v2] test: Add test for messages with missing headers\r
25 In-Reply-To: <1344389313-7886-1-git-send-email-amdragon@mit.edu>\r
26 References: <1344374501-28185-1-git-send-email-amdragon@mit.edu>\r
27         <1344389313-7886-1-git-send-email-amdragon@mit.edu>\r
28 User-Agent: Notmuch/0.13.2+128~g07453d8 (http://notmuchmail.org) Emacs/23.1.1\r
29         (x86_64-redhat-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Wed, 08 Aug 2012 11:08:30 +0300\r
34 Message-ID: <m2k3x9olfl.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain; charset=us-ascii\r
37 X-BeenThere: notmuch@notmuchmail.org\r
38 X-Mailman-Version: 2.1.13\r
39 Precedence: list\r
40 List-Id: "Use and development of the notmuch mail system."\r
41         <notmuch.notmuchmail.org>\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
43         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
45 List-Post: <mailto:notmuch@notmuchmail.org>\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
49 X-List-Received-Date: Wed, 08 Aug 2012 08:08:23 -0000\r
50 \r
51 On Wed, Aug 08 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
52 \r
53 > Currently the JSON tests for search and show are broken because\r
54 > notmuch attempts to dereference a NULL pointer.\r
55 > ---\r
56 > This version fixes the "Show: text" test so that it sanitize its\r
57 > output and doesn't hard-code my test paths.\r
58 \r
59 +1\r
60 \r
61 Tomi\r
62 \r
63 w/ python json(.tool) the original order cannot be preserved as the parser\r
64 stores content into dictionary -- without sorting those came in some\r
65 internal python order... the following code could be used to use less\r
66 indentation, though:\r
67 \r
68 python -c 'import sys,json; j = json.load(sys.stdin);\r
69 json.dump(j, sys.stdout, sort_keys=True, indent=2)' < input_file\r
70 \r
71 The other "problem" with json.tool is that it converts non-ascii chars\r
72 to \uNNNN values :/.\r
73 \r
74 What we could do is to dig a simple c json formatter -- someday in the\r
75 future, maybe -- but for *now* this is the best we can have :D\r
76 \r
77 >\r
78 >  test/missing-headers |  162 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
79 >  test/notmuch-test    |    1 +\r
80 >  2 files changed, 163 insertions(+)\r
81 >  create mode 100755 test/missing-headers\r
82 >\r
83 > diff --git a/test/missing-headers b/test/missing-headers\r
84 > new file mode 100755\r
85 > index 0000000..e79f922\r
86 > --- /dev/null\r
87 > +++ b/test/missing-headers\r
88 > @@ -0,0 +1,162 @@\r
89 > +#!/usr/bin/env bash\r
90 > +test_description='messages with missing headers'\r
91 > +. ./test-lib.sh\r
92 > +\r
93 > +# Notmuch requires at least one of from, subject, or to or it will\r
94 > +# ignore the file.  Generate two messages so that together they cover\r
95 > +# all possible missing headers.  We also give one of the messages a\r
96 > +# date to ensure stable result ordering.\r
97 > +\r
98 > +cat <<EOF > "${MAIL_DIR}/msg-2"\r
99 > +To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
100 > +Date: Fri, 05 Jan 2001 15:43:57 +0000\r
101 > +\r
102 > +Body\r
103 > +EOF\r
104 > +\r
105 > +cat <<EOF > "${MAIL_DIR}/msg-1"\r
106 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
107 > +\r
108 > +Body\r
109 > +EOF\r
110 > +\r
111 > +NOTMUCH_NEW\r
112 > +\r
113 > +test_begin_subtest "Search: text"\r
114 > +output=$(notmuch search '*' | notmuch_search_sanitize)\r
115 > +test_expect_equal "$output" "\\r
116 > +thread:XXX   2001-01-05 [1/1] (null);  (inbox unread)\r
117 > +thread:XXX   1970-01-01 [1/1] Notmuch Test Suite;  (inbox unread)"\r
118 > +\r
119 > +test_begin_subtest "Search: json"\r
120 > +test_subtest_known_broken\r
121 > +output=$(notmuch search --format=json '*' | notmuch_search_sanitize)\r
122 > +test_expect_equal_json "$output" '\r
123 > +[\r
124 > +    {\r
125 > +        "authors": "",\r
126 > +        "date_relative": "2001-01-05",\r
127 > +        "matched": 1,\r
128 > +        "subject": "",\r
129 > +        "tags": [\r
130 > +            "inbox",\r
131 > +            "unread"\r
132 > +        ],\r
133 > +        "thread": "XXX",\r
134 > +        "timestamp": 978709437,\r
135 > +        "total": 1\r
136 > +    },\r
137 > +    {\r
138 > +        "authors": "Notmuch Test Suite",\r
139 > +        "date_relative": "1970-01-01",\r
140 > +        "matched": 1,\r
141 > +        "subject": "",\r
142 > +        "tags": [\r
143 > +            "inbox",\r
144 > +            "unread"\r
145 > +        ],\r
146 > +        "thread": "XXX",\r
147 > +        "timestamp": 0,\r
148 > +        "total": 1\r
149 > +    }\r
150 > +]'\r
151 > +\r
152 > +test_begin_subtest "Show: text"\r
153 > +output=$(notmuch show '*' | notmuch_show_sanitize)\r
154 > +test_expect_equal "$output" "\\r
155 > +\f\r
156 message{ id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-2\r
157 > +\f\r
158 header{\r
159 > + (2001-01-05) (inbox unread)\r
160 > +Subject: (null)\r
161 > +From: (null)\r
162 > +To: Notmuch Test Suite <test_suite@notmuchmail.org>\r
163 > +Date: Fri, 05 Jan 2001 15:43:57 +0000\r
164 > +\f\r
165 header}\r
166 > +\f\r
167 body{\r
168 > +\f\r
169 part{ ID: 1, Content-type: text/plain\r
170 > +Body\r
171 > +\f\r
172 part}\r
173 > +\f\r
174 body}\r
175 > +\f\r
176 message}\r
177 > +\f\r
178 message{ id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-1\r
179 > +\f\r
180 header{\r
181 > +Notmuch Test Suite <test_suite@notmuchmail.org> (1970-01-01) (inbox unread)\r
182 > +Subject: (null)\r
183 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>\r
184 > +Date: Thu, 01 Jan 1970 00:00:00 +0000\r
185 > +\f\r
186 header}\r
187 > +\f\r
188 body{\r
189 > +\f\r
190 part{ ID: 1, Content-type: text/plain\r
191 > +Body\r
192 > +\f\r
193 part}\r
194 > +\f\r
195 body}\r
196 > +\f\r
197 message}"\r
198 > +\r
199 > +test_begin_subtest "Show: json"\r
200 > +test_subtest_known_broken\r
201 > +output=$(notmuch show --format=json '*' | notmuch_json_show_sanitize)\r
202 > +test_expect_equal_json "$output" '\r
203 > +[\r
204 > +    [\r
205 > +        [\r
206 > +            {\r
207 > +                "body": [\r
208 > +                    {\r
209 > +                        "content": "Body\n",\r
210 > +                        "content-type": "text/plain",\r
211 > +                        "id": 1\r
212 > +                    }\r
213 > +                ],\r
214 > +                "date_relative": "2001-01-05",\r
215 > +                "excluded": false,\r
216 > +                "filename": "YYYYY",\r
217 > +                "headers": {\r
218 > +                    "Date": "Fri, 05 Jan 2001 15:43:57 +0000",\r
219 > +                    "From": "",\r
220 > +                    "Subject": "",\r
221 > +                    "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"\r
222 > +                },\r
223 > +                "id": "XXXXX",\r
224 > +                "match": true,\r
225 > +                "tags": [\r
226 > +                    "inbox",\r
227 > +                    "unread"\r
228 > +                ],\r
229 > +                "timestamp": 978709437\r
230 > +            },\r
231 > +            []\r
232 > +        ]\r
233 > +    ],\r
234 > +    [\r
235 > +        [\r
236 > +            {\r
237 > +                "body": [\r
238 > +                    {\r
239 > +                        "content": "Body\n",\r
240 > +                        "content-type": "text/plain",\r
241 > +                        "id": 1\r
242 > +                    }\r
243 > +                ],\r
244 > +                "date_relative": "1970-01-01",\r
245 > +                "excluded": false,\r
246 > +                "filename": "YYYYY",\r
247 > +                "headers": {\r
248 > +                    "Date": "Thu, 01 Jan 1970 00:00:00 +0000",\r
249 > +                    "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",\r
250 > +                    "Subject": ""\r
251 > +                },\r
252 > +                "id": "XXXXX",\r
253 > +                "match": true,\r
254 > +                "tags": [\r
255 > +                    "inbox",\r
256 > +                    "unread"\r
257 > +                ],\r
258 > +                "timestamp": 0\r
259 > +            },\r
260 > +            []\r
261 > +        ]\r
262 > +    ]\r
263 > +]'\r
264 > +\r
265 > +\r
266 > +test_done\r
267 > diff --git a/test/notmuch-test b/test/notmuch-test\r
268 > index ea39dfc..cc732c3 100755\r
269 > --- a/test/notmuch-test\r
270 > +++ b/test/notmuch-test\r
271 > @@ -59,6 +59,7 @@ TESTS="\r
272 >    emacs-address-cleaning\r
273 >    emacs-hello\r
274 >    emacs-show\r
275 > +  missing-headers\r
276 >  "\r
277 >  TESTS=${NOTMUCH_TESTS:=$TESTS}\r
278 >  \r
279 > -- \r
280 > 1.7.10\r
281 >\r
282 > _______________________________________________\r
283 > notmuch mailing list\r
284 > notmuch@notmuchmail.org\r
285 > http://notmuchmail.org/mailman/listinfo/notmuch\r