From: Pieter Praet <pieter@praet.org>
To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
Cc: Notmuch Mail <notmuch@notmuchmail.org>
Subject: Re: [PATCH v4] test: emacs: add test for `notmuch-search-operate-all'
Date: Wed, 01 Feb 2012 14:44:48 +0100 [thread overview]
Message-ID: <877h067jn3.fsf@praet.org> (raw)
In-Reply-To: <87y5spober.fsf@gmail.com>
On Mon, 30 Jan 2012 12:13:48 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> Hi Pieter.
>
> On Mon, 30 Jan 2012 08:45:50 +0100, Pieter Praet <pieter@praet.org> wrote:
> > `notmuch-search-operate-all' (bound to "*") adds and removes tags
> > to/from all messages which match the query used to populate the
> > current search buffer.
> >
> > ---
> >
> > Rebased to current master.
> >
> > Previous versions (chronologically):
> > - id:"1309450108-2793-1-git-send-email-pieter@praet.org"
> > - id:"1309762318-4530-5-git-send-email-pieter@praet.org"
> > - id:"1310313335-4159-5-git-send-email-pieter@praet.org"
> >
>
> This looks like a useful patch series. We definitely need more tests
> for tagging operations in the Emacs UI. Do you plan to revive it?
>
Absolutely. In fact, it's still alive and kicking on a local branch :)
> Note that not so long ago I posted a bunch of tagging-related patches
> [1] that would conflict with this patch at least because of
> `notmuch-search-operate-all' being renamed to `notmuch-search-tag-all'.
>
Nice series! Will probably be pushed in the next few days,
so I'll hold off on resubmitting the tests until then.
> >
> > test/emacs | 19 +++++++++++++++++++
> > 1 files changed, 19 insertions(+), 0 deletions(-)
> >
> > diff --git a/test/emacs b/test/emacs
> > index 8ca4c8a..e94ad94 100755
> > --- a/test/emacs
> > +++ b/test/emacs
> > @@ -124,6 +124,25 @@ test_emacs "(notmuch-show \"$os_x_darwin_thread\")
> > output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
> > 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)"
> >
> > +test_begin_subtest "Add/remove tags to/from all matching messages."
> > +test_emacs '(notmuch-search "tag:inbox AND tags")
> > + (notmuch-test-wait)
> > + (notmuch-search-operate-all "+matching" "-inbox")
> > + (notmuch-search "tag:matching AND NOT tag:inbox")
> > + (notmuch-test-wait)
> > + (test-output)'
> > +cat <<EOF >EXPECTED
> > + 2009-11-18 [3/3] Adrian Perez de Castro, Keith Packard, Carl Worth [notmuch] Introducing myself (matching signed unread)
> > + 2009-11-18 [1/3] Carl Worth, Israel Herraiz, Keith Packard [notmuch] New to the list (inbox matching unread)
> > + 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)
> > + 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)
> > + 2009-11-18 [1/1] Jan Janak [notmuch] [PATCH] notmuch new: Support for conversion of spool subdirectories into tags (matching unread)
> > + 2009-11-18 [1/1] Stewart Smith [notmuch] [PATCH] Fix linking with gcc to use g++ to link in C++ libs. (matching unread)
> > + 2009-11-17 [1/2] Ingmar Vanhassel, Carl Worth [notmuch] [PATCH] Typsos (inbox matching unread)
> > +End of search results.
> > +EOF
> > +test_expect_equal_file OUTPUT EXPECTED
>
> I am worried that this test would break because of changes in other
> tests. E.g. if a new test adds a new message which matches "tag:inbox
> AND tags", this test would have to be updated. I think we should avoid
> this. I see the following options here:
>
> * Search for messages which are less likely to change, e.g. "from:carl".
>
> * Rework the test to avoid using any fixed expected results, e.g.:
>
> - count all messages with tag:inbox
>
> - remove inbox tag, add some other distinct tag for all messages with
> tag:inbox
>
> - count all messages with tag:inbox again, check that it is 0
>
> - add the inbox tag back, remove the previously added tag, check the
> message count
>
> I like the latter approach because it does not compare Emacs UI output
> and hence would not break when that output changes. What do you think?
>
> Also, we should leave notmuch db in the same state as it was before the
> test if possible.
>
Good point(s)!
How about this:
#+begin_src sh
test_begin_subtest "Add/remove tags to/from all matching messages."
expected=$(notmuch count from:cworth AND tag:inbox)
test "${expected}" == "0" && expected="Need more matches!" # prevent false positives
test_emacs "(notmuch-search \"from:cworth AND tag:inbox\")
(notmuch-test-wait)
(notmuch-search-operate-all \"+matching\" \"-inbox\")"
output=$(notmuch count from:cworth AND tag:matching AND NOT tag:inbox)
notmuch tag -matching +inbox -- from:cworth AND tag:matching AND NOT tag:inbox # restore db state!
test_expect_equal "$output" "$expected"
#+end_src
> Regards,
> Dmitry
>
> [1] id:"1327901644-15799-1-git-send-email-dmitry.kurochkin@gmail.com"
>
> > +
> > test_begin_subtest "Message with .. in Message-Id:"
> > add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
> > test_emacs '(notmuch-search "id:\"123..456@example\"")
> > --
> > 1.7.8.1
> >
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
Peace
--
Pieter
next prev parent reply other threads:[~2012-02-01 13:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-26 1:12 [PATCH] emacs: add completion to "tag all" operation ("*" binding) Dmitry Kurochkin
2012-01-26 1:26 ` [PATCH v2] " Dmitry Kurochkin
2012-01-26 1:37 ` [PATCH] " Austin Clements
2012-01-26 1:47 ` Dmitry Kurochkin
2012-01-26 8:46 ` David Edmondson
2012-01-26 17:39 ` Dmitry Kurochkin
2012-01-26 2:45 ` [PATCH v3] " Dmitry Kurochkin
2012-01-26 5:06 ` [PATCH v4] " Dmitry Kurochkin
2012-01-26 7:04 ` Austin Clements
2012-01-26 17:37 ` Dmitry Kurochkin
2012-01-26 17:34 ` [PATCH v5 0/2] emacs: add completion to "tag all" operation Dmitry Kurochkin
2012-01-26 17:34 ` [PATCH v5 1/2] emacs: add completion to "tag all" operation ("*" binding) Dmitry Kurochkin
2012-01-27 11:55 ` David Bremner
2012-01-26 17:34 ` [PATCH v5 2/2] emacs: `notmuch-search-operate-all' code cleanup, no functional changes Dmitry Kurochkin
2012-01-27 11:56 ` David Bremner
2012-01-26 18:18 ` [PATCH v5 0/2] emacs: add completion to "tag all" operation David Edmondson
2012-01-26 18:35 ` Austin Clements
2012-01-30 7:45 ` [PATCH v4] test: emacs: add test for `notmuch-search-operate-all' Pieter Praet
2012-01-30 8:13 ` Dmitry Kurochkin
2012-02-01 13:44 ` Pieter Praet [this message]
2012-02-01 14:06 ` Dmitry Kurochkin
2012-02-01 20:32 ` Pieter Praet
2012-02-01 23:25 ` Dmitry Kurochkin
2012-02-19 20:42 ` Pieter Praet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877h067jn3.fsf@praet.org \
--to=pieter@praet.org \
--cc=dmitry.kurochkin@gmail.com \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).