1 Return-Path: <dmitry.kurochkin@gmail.com>
\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 07ADF431FAF
\r
6 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 15:26:59 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 67WbPh9gcmx1 for <notmuch@notmuchmail.org>;
\r
17 Wed, 1 Feb 2012 15:26:58 -0800 (PST)
\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com
\r
19 [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 995EA431FAE
\r
22 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 15:26:57 -0800 (PST)
\r
23 Received: by bke11 with SMTP id 11so1713715bke.26
\r
24 for <notmuch@notmuchmail.org>; Wed, 01 Feb 2012 15:26:56 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=from:to:cc:subject:in-reply-to:references:user-agent:date
\r
27 :message-id:mime-version:content-type;
\r
28 bh=uP67WGWVrYqQgk2NUEOVjtoflXMIGB+w+zdhX1TK4Lo=;
\r
29 b=AwVl80YCzalsc9mBL+aJ8XFc+XXi0bWN5pAJdPFhnfVG6B5uA+kAR2kYshSABSR/Af
\r
30 Sgpvxn2BIy14qDkX3aufyrp2Fyf8KlR9H67JXgbBs0q59AamlAYQRhrLxBZ/pmWGo6bS
\r
31 ujieHVBxSVE3cJr/4ghdt3AzxBrR432nKMucQ=
\r
32 Received: by 10.204.156.5 with SMTP id u5mr244510bkw.84.1328138814858;
\r
33 Wed, 01 Feb 2012 15:26:54 -0800 (PST)
\r
34 Received: from localhost ([91.144.186.21])
\r
35 by mx.google.com with ESMTPS id 20sm1383152bkr.0.2012.02.01.15.26.53
\r
36 (version=TLSv1/SSLv3 cipher=OTHER);
\r
37 Wed, 01 Feb 2012 15:26:53 -0800 (PST)
\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
39 To: Pieter Praet <pieter@praet.org>
\r
40 Subject: Re: [PATCH v4] test: emacs: add test for `notmuch-search-operate-all'
\r
41 In-Reply-To: <87liomb8gv.fsf@praet.org>
\r
42 References: <1327599289-16865-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
43 <1327909550-6788-1-git-send-email-pieter@praet.org>
\r
44 <87y5spober.fsf@gmail.com> <877h067jn3.fsf@praet.org>
\r
45 <87hazamywi.fsf@gmail.com> <87liomb8gv.fsf@praet.org>
\r
46 User-Agent: Notmuch/0.11+139~gd9b7cab (http://notmuchmail.org) Emacs/23.3.1
\r
47 (x86_64-pc-linux-gnu)
\r
48 Date: Thu, 02 Feb 2012 03:25:40 +0400
\r
49 Message-ID: <8762fqm8zv.fsf@gmail.com>
\r
51 Content-Type: text/plain; charset=us-ascii
\r
52 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
53 X-BeenThere: notmuch@notmuchmail.org
\r
54 X-Mailman-Version: 2.1.13
\r
56 List-Id: "Use and development of the notmuch mail system."
\r
57 <notmuch.notmuchmail.org>
\r
58 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
59 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
60 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
61 List-Post: <mailto:notmuch@notmuchmail.org>
\r
62 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
63 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
65 X-List-Received-Date: Wed, 01 Feb 2012 23:26:59 -0000
\r
69 On Wed, 01 Feb 2012 21:32:32 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
70 > On Wed, 01 Feb 2012 18:06:05 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
71 > > On Wed, 01 Feb 2012 14:44:48 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
72 > > > On Mon, 30 Jan 2012 12:13:48 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
75 > > > > On Mon, 30 Jan 2012 08:45:50 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
76 > > > > > `notmuch-search-operate-all' (bound to "*") adds and removes tags
\r
77 > > > > > to/from all messages which match the query used to populate the
\r
78 > > > > > current search buffer.
\r
82 > > > > > Rebased to current master.
\r
84 > > > > > Previous versions (chronologically):
\r
85 > > > > > - id:"1309450108-2793-1-git-send-email-pieter@praet.org"
\r
86 > > > > > - id:"1309762318-4530-5-git-send-email-pieter@praet.org"
\r
87 > > > > > - id:"1310313335-4159-5-git-send-email-pieter@praet.org"
\r
90 > > > > This looks like a useful patch series. We definitely need more tests
\r
91 > > > > for tagging operations in the Emacs UI. Do you plan to revive it?
\r
94 > > > Absolutely. In fact, it's still alive and kicking on a local branch :)
\r
97 > > > > Note that not so long ago I posted a bunch of tagging-related patches
\r
98 > > > > [1] that would conflict with this patch at least because of
\r
99 > > > > `notmuch-search-operate-all' being renamed to `notmuch-search-tag-all'.
\r
102 > > > Nice series! Will probably be pushed in the next few days,
\r
103 > > > so I'll hold off on resubmitting the tests until then.
\r
107 > > > > > test/emacs | 19 +++++++++++++++++++
\r
108 > > > > > 1 files changed, 19 insertions(+), 0 deletions(-)
\r
110 > > > > > diff --git a/test/emacs b/test/emacs
\r
111 > > > > > index 8ca4c8a..e94ad94 100755
\r
112 > > > > > --- a/test/emacs
\r
113 > > > > > +++ b/test/emacs
\r
114 > > > > > @@ -124,6 +124,25 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
\r
115 > > > > > output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
\r
116 > > > > > test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
\r
118 > > > > > +test_begin_subtest "Add/remove tags to/from all matching messages."
\r
119 > > > > > +test_emacs '(notmuch-search "tag:inbox AND tags")
\r
120 > > > > > + (notmuch-test-wait)
\r
121 > > > > > + (notmuch-search-operate-all "+matching" "-inbox")
\r
122 > > > > > + (notmuch-search "tag:matching AND NOT tag:inbox")
\r
123 > > > > > + (notmuch-test-wait)
\r
124 > > > > > + (test-output)'
\r
125 > > > > > +cat <<EOF >EXPECTED
\r
126 > > > > > + 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth [notmuch] Introducing myself (matching signed unread)
\r
127 > > > > > + 2009-11-18 [1/3] Carl Worth, Israel Herraiz, Keith Packard [notmuch] New to the list (inbox matching unread)
\r
128 > > > > > + 2009-11-18 [2/2] Keith Packard, Carl Worth [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove inbox (and unread) tags (matching unread)
\r
129 > > > > > + 2009-11-18 [1/2] Keith Packard, Alexander Botero-Lowry [notmuch] [PATCH] Create a default notmuch-show-hook that highlights URLs and uses word-wrap (inbox matching unread)
\r
130 > > > > > + 2009-11-18 [1/1] Jan Janak [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (matching unread)
\r
131 > > > > > + 2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (matching unread)
\r
132 > > > > > + 2009-11-17 [1/2] Ingmar Vanhassel, Carl Worth [notmuch] [PATCH] Typsos (inbox matching unread)
\r
133 > > > > > +End of search results.
\r
135 > > > > > +test_expect_equal_file OUTPUT EXPECTED
\r
137 > > > > I am worried that this test would break because of changes in other
\r
138 > > > > tests. E.g. if a new test adds a new message which matches "tag:inbox
\r
139 > > > > AND tags", this test would have to be updated. I think we should avoid
\r
140 > > > > this. I see the following options here:
\r
142 > > > > * Search for messages which are less likely to change, e.g. "from:carl".
\r
144 > > > > * Rework the test to avoid using any fixed expected results, e.g.:
\r
146 > > > > - count all messages with tag:inbox
\r
148 > > > > - remove inbox tag, add some other distinct tag for all messages with
\r
151 > > > > - count all messages with tag:inbox again, check that it is 0
\r
153 > > > > - add the inbox tag back, remove the previously added tag, check the
\r
154 > > > > message count
\r
156 > > > > I like the latter approach because it does not compare Emacs UI output
\r
157 > > > > and hence would not break when that output changes. What do you think?
\r
159 > > > > Also, we should leave notmuch db in the same state as it was before the
\r
160 > > > > test if possible.
\r
163 > > > Good point(s)!
\r
165 > > > How about this:
\r
167 > > > #+begin_src sh
\r
168 > > > test_begin_subtest "Add/remove tags to/from all matching messages."
\r
169 > > > expected=$(notmuch count from:cworth AND tag:inbox)
\r
170 > > > test "${expected}" == "0" && expected="Need more matches!" # prevent false positives
\r
171 > > > test_emacs "(notmuch-search \"from:cworth AND tag:inbox\")
\r
172 > > > (notmuch-test-wait)
\r
173 > > > (notmuch-search-operate-all \"+matching\" \"-inbox\")"
\r
174 > > > output=$(notmuch count from:cworth AND tag:matching AND NOT tag:inbox)
\r
175 > > > notmuch tag -matching +inbox -- from:cworth AND tag:matching AND NOT tag:inbox # restore db state!
\r
176 > > > test_expect_equal "$output" "$expected"
\r
180 > > I think "from:cworth" is not needed here. In my previous email I meant
\r
181 > > this as an alternative option to testing using counts.
\r
184 > I know, but I decided to include it anyway, on the basis that it
\r
185 > increases the probability of the search buffer containing threads with
\r
186 > matched *as well as* unmatched messages, thus providing more insurance
\r
187 > wrt `notmuch-search-operate-all' doing The Right Thing (TM).
\r
190 > > Probably we should add more counts in the test? E.g.:
\r
192 > > * before tagging
\r
193 > > - count tag:matching, it must be zero
\r
195 > > * after -inbox +matching
\r
196 > > - count tag:matching, it must be equal to $expected
\r
197 > > - count tag:inbox, it must be zero
\r
199 > > * after +inbox -matching
\r
200 > > - count tag:matching, it must be zero
\r
201 > > - count tag:inbox, it must be equal to $expected
\r
203 > > We can compare it in a single test_expect_equal call. Actual and
\r
204 > > expected results may be smth like:
\r
206 > > initial tag:matching count: n1
\r
207 > > tag:inbox count after tagging: n2
\r
208 > > tag:matching count after tagging: n3
\r
209 > > tag:inbox count after restoring: n4
\r
210 > > tag:matching count after restoring: n5
\r
212 > > In case of failure, we should get a nice diff.
\r
215 > OK, how about this?:
\r
218 Looks good. Minor comments below.
\r
221 > test_begin_subtest "Add/remove tags to/from all matching messages."
\r
223 We should add notmuch-search here, because similar functionality would
\r
224 be available in notmuch-show soon. Also, I suggest replacing
\r
225 "add/remove tags to/from" with "change tags". Consider:
\r
227 Change tags for all matching threads in notmuch-search.
\r
229 > old="inbox" ; new="xobni" ; filter="AND from:cworth"
\r
231 I would prefer this to be on separate lines.
\r
233 > o1=$(notmuch count tag:"${old}" "${filter}") ; n1=$(notmuch count tag:"${new}" "${filter}")
\r
235 I would definately prefer this to be on separate lines.
\r
237 Also, please consider s/o1/old_count_1, s/n1/new_count_1/ and so on.
\r
239 > test "${o1}" == "0" && o1="Need more matches!" # prevent false positives
\r
240 > test_emacs "(notmuch-search \"tag:${old} ${filter}\")
\r
241 > (notmuch-test-wait)
\r
242 > (notmuch-search-operate-all \"+${new}\" \"-${old}\")"
\r
243 > o2=$(notmuch count tag:"${old}" "${filter}") ; n2=$(notmuch count tag:"${new}" "${filter}")
\r
245 Same comment about separate lines.
\r
247 > notmuch tag -"${new}" +"${old}" -- tag:"${new}" "${filter}" AND NOT tag:"${old}"} # restore db state!
\r
249 Why "AND NOT tag:$old" is needed here?
\r
251 Since the line is too long, please move the comment to a separate line
\r
254 Since we are testing Emacs UI, should we restore db though Emacs as
\r
257 > o3=$(notmuch count tag:"${old}" "${filter}") ; n3=$(notmuch count tag:"${new}" "${filter}")
\r
259 Same comment about separate lines.
\r
262 > before: ${old}=$o1 ${new}=$n1
\r
263 > after: ${old}=$o2 ${new}=$n2
\r
264 > restored: ${old}=$o3 ${new}=$n3"
\r
266 > before: ${old}=$o1 ${new}=0
\r
267 > after: ${old}=0 ${new}=$o1
\r
268 > restored: ${old}=$o1 ${new}=0"
\r
270 I would change "=" to ":".
\r
275 > test_expect_equal "$output" "$expected"
\r
286 > > > > [1] id:"1327901644-15799-1-git-send-email-dmitry.kurochkin@gmail.com"
\r
289 > > > > > test_begin_subtest "Message with .. in Message-Id:"
\r
290 > > > > > add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
\r
291 > > > > > test_emacs '(notmuch-search "id:\"123..456@example\"")
\r
295 > > > > _______________________________________________
\r
296 > > > > notmuch mailing list
\r
297 > > > > notmuch@notmuchmail.org
\r
298 > > > > http://notmuchmail.org/mailman/listinfo/notmuch
\r