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
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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
36 Content-Type: text/plain; charset=us-ascii
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\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
51 On Wed, Aug 08 2012, Austin Clements <amdragon@MIT.EDU> wrote:
\r
53 > Currently the JSON tests for search and show are broken because
\r
54 > notmuch attempts to dereference a NULL pointer.
\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
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
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
71 The other "problem" with json.tool is that it converts non-ascii chars
\r
72 to \uNNNN values :/.
\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
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
83 > diff --git a/test/missing-headers b/test/missing-headers
\r
84 > new file mode 100755
\r
85 > index 0000000..e79f922
\r
87 > +++ b/test/missing-headers
\r
89 > +#!/usr/bin/env bash
\r
90 > +test_description='messages with missing headers'
\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
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
105 > +cat <<EOF > "${MAIL_DIR}/msg-1"
\r
106 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\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
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
126 > + "date_relative": "2001-01-05",
\r
133 > + "thread": "XXX",
\r
134 > + "timestamp": 978709437,
\r
138 > + "authors": "Notmuch Test Suite",
\r
139 > + "date_relative": "1970-01-01",
\r
146 > + "thread": "XXX",
\r
147 > + "timestamp": 0,
\r
152 > +test_begin_subtest "Show: text"
\r
153 > +output=$(notmuch show '*' | notmuch_show_sanitize)
\r
154 > +test_expect_equal "$output" "\
\r
156 message{ id:notmuch-sha1-7a6e4eac383ef958fcd3ebf2143db71b8ff01161 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-2
\r
159 > + (2001-01-05) (inbox unread)
\r
162 > +To: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
163 > +Date: Fri, 05 Jan 2001 15:43:57 +0000
\r
169 part{ ID: 1, Content-type: text/plain
\r
178 message{ id:notmuch-sha1-ca55943aff7a72baf2ab21fa74fab3d632401334 depth:0 match:1 excluded:0 filename:/XXX/mail/msg-1
\r
181 > +Notmuch Test Suite <test_suite@notmuchmail.org> (1970-01-01) (inbox unread)
\r
183 > +From: Notmuch Test Suite <test_suite@notmuchmail.org>
\r
184 > +Date: Thu, 01 Jan 1970 00:00:00 +0000
\r
190 part{ ID: 1, Content-type: text/plain
\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
209 > + "content": "Body\n",
\r
210 > + "content-type": "text/plain",
\r
214 > + "date_relative": "2001-01-05",
\r
215 > + "excluded": false,
\r
216 > + "filename": "YYYYY",
\r
218 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000",
\r
221 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>"
\r
229 > + "timestamp": 978709437
\r
239 > + "content": "Body\n",
\r
240 > + "content-type": "text/plain",
\r
244 > + "date_relative": "1970-01-01",
\r
245 > + "excluded": false,
\r
246 > + "filename": "YYYYY",
\r
248 > + "Date": "Thu, 01 Jan 1970 00:00:00 +0000",
\r
249 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\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
275 > + missing-headers
\r
277 > TESTS=${NOTMUCH_TESTS:=$TESTS}
\r
282 > _______________________________________________
\r
283 > notmuch mailing list
\r
284 > notmuch@notmuchmail.org
\r
285 > http://notmuchmail.org/mailman/listinfo/notmuch
\r