1 Return-Path: <pieter@praet.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 5653B431FAF
\r
6 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 12:34:38 -0800 (PST)
\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 FjafQA4SdCdH for <notmuch@notmuchmail.org>;
\r
16 Wed, 1 Feb 2012 12:34:37 -0800 (PST)
\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
18 [74.125.82.181]) (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 EFB73431FAE
\r
21 for <notmuch@notmuchmail.org>; Wed, 1 Feb 2012 12:34:36 -0800 (PST)
\r
22 Received: by werb10 with SMTP id b10so1459889wer.26
\r
23 for <notmuch@notmuchmail.org>; Wed, 01 Feb 2012 12:34:34 -0800 (PST)
\r
24 Received: by 10.216.139.25 with SMTP id b25mr10091wej.28.1328128474267;
\r
25 Wed, 01 Feb 2012 12:34:34 -0800 (PST)
\r
26 Received: from localhost ([109.131.39.11])
\r
27 by mx.google.com with ESMTPS id di5sm366991wib.3.2012.02.01.12.34.32
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Wed, 01 Feb 2012 12:34:33 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
32 Subject: Re: [PATCH v4] test: emacs: add test for `notmuch-search-operate-all'
\r
33 In-Reply-To: <87hazamywi.fsf@gmail.com>
\r
34 References: <1327599289-16865-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
35 <1327909550-6788-1-git-send-email-pieter@praet.org>
\r
36 <87y5spober.fsf@gmail.com> <877h067jn3.fsf@praet.org>
\r
37 <87hazamywi.fsf@gmail.com>
\r
38 User-Agent: Notmuch/0.11+132~ga81001f (http://notmuchmail.org) Emacs/23.3.1
\r
39 (x86_64-unknown-linux-gnu)
\r
40 Date: Wed, 01 Feb 2012 21:32:32 +0100
\r
41 Message-ID: <87liomb8gv.fsf@praet.org>
\r
43 Content-Type: text/plain; charset=us-ascii
\r
44 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
45 X-BeenThere: notmuch@notmuchmail.org
\r
46 X-Mailman-Version: 2.1.13
\r
48 List-Id: "Use and development of the notmuch mail system."
\r
49 <notmuch.notmuchmail.org>
\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
53 List-Post: <mailto:notmuch@notmuchmail.org>
\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
57 X-List-Received-Date: Wed, 01 Feb 2012 20:34:38 -0000
\r
59 On Wed, 01 Feb 2012 18:06:05 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
60 > On Wed, 01 Feb 2012 14:44:48 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
61 > > On Mon, 30 Jan 2012 12:13:48 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
\r
64 > > > On Mon, 30 Jan 2012 08:45:50 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
65 > > > > `notmuch-search-operate-all' (bound to "*") adds and removes tags
\r
66 > > > > to/from all messages which match the query used to populate the
\r
67 > > > > current search buffer.
\r
71 > > > > Rebased to current master.
\r
73 > > > > Previous versions (chronologically):
\r
74 > > > > - id:"1309450108-2793-1-git-send-email-pieter@praet.org"
\r
75 > > > > - id:"1309762318-4530-5-git-send-email-pieter@praet.org"
\r
76 > > > > - id:"1310313335-4159-5-git-send-email-pieter@praet.org"
\r
79 > > > This looks like a useful patch series. We definitely need more tests
\r
80 > > > for tagging operations in the Emacs UI. Do you plan to revive it?
\r
83 > > Absolutely. In fact, it's still alive and kicking on a local branch :)
\r
86 > > > Note that not so long ago I posted a bunch of tagging-related patches
\r
87 > > > [1] that would conflict with this patch at least because of
\r
88 > > > `notmuch-search-operate-all' being renamed to `notmuch-search-tag-all'.
\r
91 > > Nice series! Will probably be pushed in the next few days,
\r
92 > > so I'll hold off on resubmitting the tests until then.
\r
96 > > > > test/emacs | 19 +++++++++++++++++++
\r
97 > > > > 1 files changed, 19 insertions(+), 0 deletions(-)
\r
99 > > > > diff --git a/test/emacs b/test/emacs
\r
100 > > > > index 8ca4c8a..e94ad94 100755
\r
101 > > > > --- a/test/emacs
\r
102 > > > > +++ b/test/emacs
\r
103 > > > > @@ -124,6 +124,25 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
\r
104 > > > > output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
\r
105 > > > > 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
107 > > > > +test_begin_subtest "Add/remove tags to/from all matching messages."
\r
108 > > > > +test_emacs '(notmuch-search "tag:inbox AND tags")
\r
109 > > > > + (notmuch-test-wait)
\r
110 > > > > + (notmuch-search-operate-all "+matching" "-inbox")
\r
111 > > > > + (notmuch-search "tag:matching AND NOT tag:inbox")
\r
112 > > > > + (notmuch-test-wait)
\r
113 > > > > + (test-output)'
\r
114 > > > > +cat <<EOF >EXPECTED
\r
115 > > > > + 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth [notmuch] Introducing myself (matching signed unread)
\r
116 > > > > + 2009-11-18 [1/3] Carl Worth, Israel Herraiz, Keith Packard [notmuch] New to the list (inbox matching unread)
\r
117 > > > > + 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
118 > > > > + 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
119 > > > > + 2009-11-18 [1/1] Jan Janak [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (matching unread)
\r
120 > > > > + 2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (matching unread)
\r
121 > > > > + 2009-11-17 [1/2] Ingmar Vanhassel, Carl Worth [notmuch] [PATCH] Typsos (inbox matching unread)
\r
122 > > > > +End of search results.
\r
124 > > > > +test_expect_equal_file OUTPUT EXPECTED
\r
126 > > > I am worried that this test would break because of changes in other
\r
127 > > > tests. E.g. if a new test adds a new message which matches "tag:inbox
\r
128 > > > AND tags", this test would have to be updated. I think we should avoid
\r
129 > > > this. I see the following options here:
\r
131 > > > * Search for messages which are less likely to change, e.g. "from:carl".
\r
133 > > > * Rework the test to avoid using any fixed expected results, e.g.:
\r
135 > > > - count all messages with tag:inbox
\r
137 > > > - remove inbox tag, add some other distinct tag for all messages with
\r
140 > > > - count all messages with tag:inbox again, check that it is 0
\r
142 > > > - add the inbox tag back, remove the previously added tag, check the
\r
143 > > > message count
\r
145 > > > I like the latter approach because it does not compare Emacs UI output
\r
146 > > > and hence would not break when that output changes. What do you think?
\r
148 > > > Also, we should leave notmuch db in the same state as it was before the
\r
149 > > > test if possible.
\r
154 > > How about this:
\r
157 > > test_begin_subtest "Add/remove tags to/from all matching messages."
\r
158 > > expected=$(notmuch count from:cworth AND tag:inbox)
\r
159 > > test "${expected}" == "0" && expected="Need more matches!" # prevent false positives
\r
160 > > test_emacs "(notmuch-search \"from:cworth AND tag:inbox\")
\r
161 > > (notmuch-test-wait)
\r
162 > > (notmuch-search-operate-all \"+matching\" \"-inbox\")"
\r
163 > > output=$(notmuch count from:cworth AND tag:matching AND NOT tag:inbox)
\r
164 > > notmuch tag -matching +inbox -- from:cworth AND tag:matching AND NOT tag:inbox # restore db state!
\r
165 > > test_expect_equal "$output" "$expected"
\r
169 > I think "from:cworth" is not needed here. In my previous email I meant
\r
170 > this as an alternative option to testing using counts.
\r
173 I know, but I decided to include it anyway, on the basis that it
\r
174 increases the probability of the search buffer containing threads with
\r
175 matched *as well as* unmatched messages, thus providing more insurance
\r
176 wrt `notmuch-search-operate-all' doing The Right Thing (TM).
\r
179 > Probably we should add more counts in the test? E.g.:
\r
182 > - count tag:matching, it must be zero
\r
184 > * after -inbox +matching
\r
185 > - count tag:matching, it must be equal to $expected
\r
186 > - count tag:inbox, it must be zero
\r
188 > * after +inbox -matching
\r
189 > - count tag:matching, it must be zero
\r
190 > - count tag:inbox, it must be equal to $expected
\r
192 > We can compare it in a single test_expect_equal call. Actual and
\r
193 > expected results may be smth like:
\r
195 > initial tag:matching count: n1
\r
196 > tag:inbox count after tagging: n2
\r
197 > tag:matching count after tagging: n3
\r
198 > tag:inbox count after restoring: n4
\r
199 > tag:matching count after restoring: n5
\r
201 > In case of failure, we should get a nice diff.
\r
204 OK, how about this?:
\r
207 test_begin_subtest "Add/remove tags to/from all matching messages."
\r
208 old="inbox" ; new="xobni" ; filter="AND from:cworth"
\r
209 o1=$(notmuch count tag:"${old}" "${filter}") ; n1=$(notmuch count tag:"${new}" "${filter}")
\r
210 test "${o1}" == "0" && o1="Need more matches!" # prevent false positives
\r
211 test_emacs "(notmuch-search \"tag:${old} ${filter}\")
\r
212 (notmuch-test-wait)
\r
213 (notmuch-search-operate-all \"+${new}\" \"-${old}\")"
\r
214 o2=$(notmuch count tag:"${old}" "${filter}") ; n2=$(notmuch count tag:"${new}" "${filter}")
\r
215 notmuch tag -"${new}" +"${old}" -- tag:"${new}" "${filter}" AND NOT tag:"${old}"} # restore db state!
\r
216 o3=$(notmuch count tag:"${old}" "${filter}") ; n3=$(notmuch count tag:"${new}" "${filter}")
\r
218 before: ${old}=$o1 ${new}=$n1
\r
219 after: ${old}=$o2 ${new}=$n2
\r
220 restored: ${old}=$o3 ${new}=$n3"
\r
222 before: ${old}=$o1 ${new}=0
\r
223 after: ${old}=0 ${new}=$o1
\r
224 restored: ${old}=$o1 ${new}=0"
\r
225 test_expect_equal "$output" "$expected"
\r
236 > > > [1] id:"1327901644-15799-1-git-send-email-dmitry.kurochkin@gmail.com"
\r
239 > > > > test_begin_subtest "Message with .. in Message-Id:"
\r
240 > > > > add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
\r
241 > > > > test_emacs '(notmuch-search "id:\"123..456@example\"")
\r
245 > > > _______________________________________________
\r
246 > > > notmuch mailing list
\r
247 > > > notmuch@notmuchmail.org
\r
248 > > > http://notmuchmail.org/mailman/listinfo/notmuch
\r