1 Return-Path: <jani@nikula.org>
\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 D28A9431FB6
\r
6 for <notmuch@notmuchmail.org>; Sat, 4 May 2013 09:23:11 -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 Ruj34YxJdC50 for <notmuch@notmuchmail.org>;
\r
16 Sat, 4 May 2013 09:23:08 -0700 (PDT)
\r
17 Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com
\r
18 [209.85.217.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id A6E8A431FAF
\r
21 for <notmuch@notmuchmail.org>; Sat, 4 May 2013 09:23:07 -0700 (PDT)
\r
22 Received: by mail-lb0-f173.google.com with SMTP id t10so2375074lbi.32
\r
23 for <notmuch@notmuchmail.org>; Sat, 04 May 2013 09:23:06 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=google.com; s=20120113;
\r
26 h=x-received:from:to:subject:in-reply-to:references:user-agent:date
\r
27 :message-id:mime-version:content-type:x-gm-message-state;
\r
28 bh=QesV6RgIEyHENxdxJ4jr47k+hh309GFqojK05iPa3oM=;
\r
29 b=A/7QrkVAB45Efg7BEPuT8893k1k3qJC+6pQOjZDtqZ4DstFUJIAIukGA91pxmjQ9lN
\r
30 /I4J6lo5/3+pK7vxQtdthzIcu5JxZKOc96easlZ48CUwuxY9coClm2p2XkMRm54f4n3M
\r
31 NhhRRX7BcPDi+5V0y3ScukTSgQmVo87RRY05mqZTPGeVKRohlz9lhbQ7t9YUa7j1IZso
\r
32 d6/+Hd/bXu4vrLRlJKpzvC5Y3/HBLD76lURwjTMbTfZGjT4HaA1ZzH+5dZ1Cf/8x4Td+
\r
33 +adwK2saB3S6/bcfLO0EHjAshvWUpR+KwTUJFNiKvrCY7a/v/eIuLqBFJkS1OgJB2Z/5
\r
35 X-Received: by 10.112.137.73 with SMTP id qg9mr5789472lbb.3.1367684586153;
\r
36 Sat, 04 May 2013 09:23:06 -0700 (PDT)
\r
37 Received: from localhost (dsl-hkibrasgw2-58c376-211.dhcp.inet.fi.
\r
38 [88.195.118.211]) by mx.google.com with ESMTPSA id
\r
39 rn10sm5824440lbb.16.2013.05.04.09.23.04 for <multiple recipients>
\r
40 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
41 Sat, 04 May 2013 09:23:05 -0700 (PDT)
\r
42 From: Jani Nikula <jani@nikula.org>
\r
43 To: Aaron Ecay <aaronecay@gmail.com>, notmuch@notmuchmail.org
\r
44 Subject: Re: [PATCH 1/2] test: add tests for the handling of References and
\r
46 In-Reply-To: <1362540709-28765-1-git-send-email-aaronecay@gmail.com>
\r
47 References: <87ppzfzxuk.fsf@zancas.localnet>
\r
48 <1362540709-28765-1-git-send-email-aaronecay@gmail.com>
\r
49 User-Agent: Notmuch/0.15.2+87~gc69f540 (http://notmuchmail.org) Emacs/24.3.1
\r
50 (x86_64-pc-linux-gnu)
\r
51 Date: Sat, 04 May 2013 19:23:00 +0300
\r
52 Message-ID: <87txmi1zq3.fsf@nikula.org>
\r
54 Content-Type: text/plain
\r
56 ALoCoQm3/685lEZ9wykLYzdVl9f8jhiD2fVl5WKx4rCFvXT2qVnARSQP8hA6KFT6VIc4wJjl/5fH
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\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, 04 May 2013 16:23:12 -0000
\r
71 On Wed, 06 Mar 2013, Aaron Ecay <aaronecay@gmail.com> wrote:
\r
72 > These tests are known_broken, the following commit fixes them.
\r
75 > Thanks to David and Tomi for pointing out test_expect_equal_json. In
\r
76 > the process of implementing that, I discovered
\r
77 > notmuch_json_show_sanitize, which I had also not been using. This
\r
78 > patch fixes the test to use both these conveniences. The second patch
\r
79 > is not changed substantively, but I am resending it for tidiness.
\r
81 > test/thread-replies | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++
\r
82 > 1 file changed, 144 insertions(+)
\r
83 > create mode 100755 test/thread-replies
\r
85 > diff --git a/test/thread-replies b/test/thread-replies
\r
86 > new file mode 100755
\r
87 > index 0000000..a902691
\r
89 > +++ b/test/thread-replies
\r
91 > +#!/usr/bin/env bash
\r
93 > +# Copyright (c) 2013 Aaron Ecay
\r
96 > +test_description='test of proper handling of in-reply-to and references headers
\r
98 > +This test makes sure that the thread structure in the notmuch database is
\r
99 > +constructed properly, even in the presence of non-RFC-compliant headers'
\r
101 Nitpick, most other tests have one line test descriptions. The second
\r
102 paragraph could be left as comment.
\r
107 > +test_begin_subtest "Use References when In-Reply-To is broken"
\r
108 > +test_subtest_known_broken
\r
109 > +add_message '[id]="foo@one.com"' \
\r
110 > + '[subject]=one'
\r
111 > +add_message '[in-reply-to]="mumble"' \
\r
112 > + '[references]="<foo@one.com>"' \
\r
113 > + '[subject]="Re: one"'
\r
114 > +output=$(notmuch show --format=json 'subject:one' | notmuch_json_show_sanitize)
\r
115 > +expected='[[[{"id": "foo@one.com",
\r
117 > + "excluded": false,
\r
118 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-001",
\r
120 Please replace the path with:
\r
122 "filename": "YYYYY",
\r
124 Ditto below for all of them.
\r
126 > + "timestamp": 978709437,
\r
127 > + "date_relative": "2001-01-05",
\r
128 > + "tags": ["inbox", "unread"],
\r
129 > + "headers": {"Subject": "one",
\r
130 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
131 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
132 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"},
\r
133 > + "body": [{"id": 1,
\r
134 > + "content-type": "text/plain",
\r
135 > + "content": "This is just a test message (#1)\n"}]},
\r
136 > + [[{"id": "msg-002@notmuch-test-suite",
\r
137 > + "match": true, "excluded": false,
\r
138 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-002",
\r
139 > + "timestamp": 978709437, "date_relative": "2001-01-05",
\r
140 > + "tags": ["inbox", "unread"], "headers": {"Subject": "Re: one",
\r
141 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
142 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
143 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"},
\r
144 > + "body": [{"id": 1, "content-type": "text/plain",
\r
145 > + "content": "This is just a test message (#2)\n"}]}, []]]]]]'
\r
146 > +expected=`echo "$expected" | notmuch_json_show_sanitize`
\r
147 > +test_expect_equal_json "$output" "$expected"
\r
149 > +test_begin_subtest "Prefer References to In-Reply-To"
\r
150 > +test_subtest_known_broken
\r
151 > +add_message '[id]="foo@two.com"' \
\r
152 > + '[subject]=two'
\r
153 > +add_message '[in-reply-to]="<bar@baz.com>"' \
\r
154 > + '[references]="<foo@two.com>"' \
\r
155 > + '[subject]="Re: two"'
\r
156 > +output=$(notmuch show --format=json 'subject:two' | notmuch_json_show_sanitize)
\r
157 > +expected='[[[{"id": "foo@two.com",
\r
158 > + "match": true, "excluded": false,
\r
159 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-003",
\r
160 > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
161 > + "headers": {"Subject": "two",
\r
162 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
163 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
164 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"},
\r
165 > + "body": [{"id": 1, "content-type": "text/plain",
\r
166 > + "content": "This is just a test message (#3)\n"}]},
\r
167 > + [[{"id": "msg-004@notmuch-test-suite", "match": true, "excluded": false,
\r
168 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-004",
\r
169 > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
170 > + "headers": {"Subject": "Re: two",
\r
171 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
172 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
173 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"},
\r
174 > + "body": [{"id": 1,
\r
175 > + "content-type": "text/plain", "content": "This is just a test message (#4)\n"}]},
\r
177 > +expected=`echo "$expected" | notmuch_json_show_sanitize`
\r
178 > +test_expect_equal_json "$output" "$expected"
\r
180 > +test_begin_subtest "Use In-Reply-To when no References"
\r
181 > +test_subtest_known_broken
\r
183 As David said, this is not broken currently, as In-Reply-To is used
\r
184 unconditionally. Just drop the broken annotation, the test itself is
\r
187 > +add_message '[id]="foo@three.com"' \
\r
188 > + '[subject]="three"'
\r
189 > +add_message '[in-reply-to]="<foo@three.com>"' \
\r
190 > + '[subject]="Re: three"'
\r
191 > +output=$(notmuch show --format=json 'subject:three' | notmuch_json_show_sanitize)
\r
192 > +expected='[[[{"id": "foo@three.com", "match": true, "excluded": false,
\r
193 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-005",
\r
194 > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
195 > + "headers": {"Subject": "three",
\r
196 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
197 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
198 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
\r
199 > + "content-type": "text/plain", "content": "This is just a test message (#5)\n"}]},
\r
200 > + [[{"id": "msg-006@notmuch-test-suite", "match": true, "excluded": false,
\r
201 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-006",
\r
202 > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
203 > + "headers": {"Subject": "Re: three",
\r
204 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
205 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
206 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
\r
207 > + "content-type": "text/plain", "content": "This is just a test message (#6)\n"}]},
\r
209 > +expected=`echo "$expected" | notmuch_json_show_sanitize`
\r
210 > +test_expect_equal_json "$output" "$expected"
\r
212 > +test_begin_subtest "Use last Reference"
\r
213 > +test_subtest_known_broken
\r
214 > +add_message '[id]="foo@four.com"' \
\r
215 > + '[subject]="four"'
\r
216 > +add_message '[id]="bar@four.com"' \
\r
217 > + '[subject]="not-four"'
\r
218 > +add_message '[in-reply-to]="<baz@four.com>"' \
\r
219 > + '[references]="<baz@four.com> <foo@four.com>"' \
\r
220 > + '[subject]="neither"'
\r
221 > +output=$(notmuch show --format=json 'subject:four' | notmuch_json_show_sanitize)
\r
222 > +expected='[[[{"id": "foo@four.com", "match": true, "excluded": false,
\r
223 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-007",
\r
224 > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
225 > + "headers": {"Subject": "four",
\r
226 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
227 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
228 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
\r
229 > + "content-type": "text/plain", "content": "This is just a test message (#7)\n"}]},
\r
230 > + [[{"id": "msg-009@notmuch-test-suite", "match": false, "excluded": false,
\r
231 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-009",
\r
232 > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
233 > + "headers": {"Subject": "neither",
\r
234 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
235 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
236 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
\r
237 > + "content-type": "text/plain", "content": "This is just a test message (#9)\n"}]},
\r
238 > + []]]]], [[{"id": "bar@four.com", "match": true, "excluded": false,
\r
239 > + "filename": "/home/aecay/development/notmuch/notmuch-git/src/notmuch/test/tmp.thread-replies/mail/msg-008",
\r
240 > + "timestamp": 978709437, "date_relative": "2001-01-05", "tags": ["inbox", "unread"],
\r
241 > + "headers": {"Subject": "not-four",
\r
242 > + "From": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
243 > + "To": "Notmuch Test Suite <test_suite@notmuchmail.org>",
\r
244 > + "Date": "Fri, 05 Jan 2001 15:43:57 +0000"}, "body": [{"id": 1,
\r
245 > + "content-type": "text/plain", "content": "This is just a test message (#8)\n"}]}, []]]]'
\r
246 > +expected=`echo "$expected" | notmuch_json_show_sanitize`
\r
247 > +test_expect_equal_json "$output" "$expected"
\r
254 > _______________________________________________
\r
255 > notmuch mailing list
\r
256 > notmuch@notmuchmail.org
\r
257 > http://notmuchmail.org/mailman/listinfo/notmuch
\r