From: Pieter Praet <pieter@praet.org>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH v4] test: emacs: new test "notmuch-search: change tags of all matching messages"
Date: Wed, 7 Mar 2012 20:49:52 +0100 [thread overview]
Message-ID: <1331149792-17192-1-git-send-email-pieter@praet.org> (raw)
In-Reply-To: <1329936867-923-1-git-send-email-pieter@praet.org>
* test/emacs-search:
- New subtest "notmuch-search: change tags of all matching messages":
`notmuch-search-tag-all' (bound to "*") adds and removes tags
to/from all messages which match the query used to populate the
current search buffer.
---
Moved to a separate file to prevent a merge conflict when applied in
conjunction with the patches listed @ id:"877gz4dnl2.fsf@praet.org".
test/emacs-search | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
test/notmuch-test | 1 +
2 files changed, 49 insertions(+), 0 deletions(-)
create mode 100755 test/emacs-search
diff --git a/test/emacs-search b/test/emacs-search
new file mode 100755
index 0000000..1cd8a89
--- /dev/null
+++ b/test/emacs-search
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+test_description="Emacs notmuch-search-mode"
+. test-lib.sh
+
+EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
+
+add_email_corpus
+
+
+test_begin_subtest "notmuch-search: change tags of all matching messages"
+old_tag="inbox"
+new_tag="xobni"
+filter="AND from:cworth"
+
+# Get initial tag counts and prevent false positives/negatives
+old_tag_count_1=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_1=$(notmuch count tag:"${new_tag}" "${filter}")
+test "${old_tag_count_1}" = "0" && old_tag_count_1="Need >0 matches!"
+test "${new_tag_count_1}" = "0" || new_tag_count_1="Need 0 matches!"
+
+# Change tags of all matching messages and get tag counts
+test_emacs "(notmuch-search \"tag:${old_tag} ${filter}\")
+ (notmuch-test-wait)
+ (notmuch-search-tag-all \"-${old_tag}\" \"+${new_tag}\")"
+old_tag_count_2=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_2=$(notmuch count tag:"${new_tag}" "${filter}")
+
+# Revert tag changes and get tag counts
+test_emacs "(notmuch-search \"tag:${new_tag} ${filter}\")
+ (notmuch-test-wait)
+ (notmuch-search-tag-all \"+${old_tag}\" \"-${new_tag}\")"
+old_tag_count_3=$(notmuch count tag:"${old_tag}" "${filter}")
+new_tag_count_3=$(notmuch count tag:"${new_tag}" "${filter}")
+
+# ... and verify the results
+output="
+before: old:${old_tag_count_1} new:${new_tag_count_1}
+after: old:${old_tag_count_2} new:${new_tag_count_2}
+restored: old:${old_tag_count_3} new:${new_tag_count_3}"
+expected="
+before: old:${old_tag_count_1} new:0
+after: old:0 new:${old_tag_count_1}
+restored: old:${old_tag_count_1} new:0"
+test_expect_equal "$output" "$expected"
+
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index e14d34e..81d0d7f 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -54,6 +54,7 @@ TESTS="
argument-parsing
emacs-test-functions
emacs-address-cleaning
+ emacs-search
emacs-show
"
TESTS=${NOTMUCH_TESTS:=$TESTS}
--
1.7.8.1
next prev parent reply other threads:[~2012-03-07 19:50 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-10 15:55 Extend test coverage wrt tagging Pieter Praet
2011-07-10 15:55 ` [PATCH 1/6] test: emacs: rename subtest "Reply within emacs" to "Compose reply in emacs" Pieter Praet
2011-07-10 15:55 ` [PATCH 2/6] test: emacs: add test for sending a reply from within Emacs Pieter Praet
2011-07-10 15:55 ` [PATCH 3/6] test: emacs: add test to verify that the message being replied to is tagged as such Pieter Praet
2011-07-10 15:55 ` [PATCH 4/6] test: emacs: add test for `notmuch-search-operate-all' Pieter Praet
2011-07-10 15:55 ` [PATCH 5/6] test: emacs: `notmuch-search-operate-all' should operate on threads, not messages Pieter Praet
2011-07-10 15:55 ` [PATCH 6/6] emacs: make `notmuch-search-operate-all' " Pieter Praet
2011-11-12 16:13 ` David Bremner
2011-11-12 16:35 ` Austin Clements
2011-11-16 13:55 ` Pieter Praet
2012-02-19 20:38 ` Pieter Praet
2012-02-19 20:38 ` [PATCH v2 1/4] test: emacs: rename subtest "Reply within emacs" Pieter Praet
2012-02-20 12:16 ` Dmitry Kurochkin
2012-02-19 20:38 ` [PATCH v2 2/4] test: emacs: new test "notmuch-search: replying to a thread (sending)" Pieter Praet
2012-02-19 21:04 ` Tomi Ollila
2012-02-22 18:49 ` Pieter Praet
2012-02-20 12:44 ` Dmitry Kurochkin
2012-02-22 18:51 ` Pieter Praet
2012-02-19 20:38 ` [PATCH v2 3/4] test: emacs: new test "notmuch-search: when reply is sent, parent message should be tagged 'replied'" Pieter Praet
2012-02-20 12:20 ` Dmitry Kurochkin
2012-02-22 18:52 ` Pieter Praet
2012-02-19 20:38 ` [PATCH v2 4/4] test: emacs: new test "notmuch-search: change tags of all matching messages" Pieter Praet
2012-02-19 21:08 ` Tomi Ollila
2012-02-22 18:53 ` Pieter Praet
2012-02-20 12:25 ` Dmitry Kurochkin
2012-02-22 18:53 ` Pieter Praet
2012-02-22 18:54 ` [PATCH v3] " Pieter Praet
2012-03-07 19:49 ` Pieter Praet [this message]
2012-03-11 18:42 ` [PATCH v4] " Tomi Ollila
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=1331149792-17192-1-git-send-email-pieter@praet.org \
--to=pieter@praet.org \
--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).