[PATCH v4] test: emacs: new test "notmuch-search: change tags of all matching messages"
On Wed, 7 Mar 2012 20:49:52 +0100, Pieter Praet wrote: > * 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 at praet.org". Hi Pieter! I did the following script: --8<8<8<8<8<8<8<8<8<8<8<-- #!/bin/sh while read line do case $line in id:*) notmuch show --format=mbox "$line" esac done < "$0" | git am exit 0 id:"1329684990-12504-2-git-send-email-pieter at praet.org" id:"1329684990-12504-3-git-send-email-pieter at praet.org" id:"1329684990-12504-4-git-send-email-pieter at praet.org" id:"1330122640-18895-2-git-send-email-pieter at praet.org" id:"1330122640-18895-3-git-send-email-pieter at praet.org" id:"1331149792-17192-1-git-send-email-pieter at praet.org" --8<8<8<8<8<8<8<8<8<8<8<-- When executed on top of current master (c46764030d, 0.11.1-1-293-gc467640) last patch (1331149792-17192-1..., this I'm replying to) fails as: error: patch failed: test/notmuch-test:54 error: test/notmuch-test: patch does not apply In order to get clear picture of the changes you wish to get reviewed please provide cleanly applicable patchset. The best possible way to inform what is to be reviewed is 1) List of message id:s of the patches, in order those are to be applied. 2) Sha1 of the commit where this patchset applies cleanly (In this case I will do review even though it would not apply on top of current master (at that time) anymore -- but *I* would not expect it to to be pushed until rebased patchset is sent again). BR, Tomi
Re: [PATCH v4] test: emacs: new test notmuch-search: change tags of all matching messages
On Wed, 7 Mar 2012 20:49:52 +0100, Pieter Praet pie...@praet.org wrote: * 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@praet.org. Hi Pieter! I did the following script: --88888888888-- #!/bin/sh while read line do case $line in id:*) notmuch show --format=mbox $line esac done $0 | git am exit 0 id:1329684990-12504-2-git-send-email-pie...@praet.org id:1329684990-12504-3-git-send-email-pie...@praet.org id:1329684990-12504-4-git-send-email-pie...@praet.org id:1330122640-18895-2-git-send-email-pie...@praet.org id:1330122640-18895-3-git-send-email-pie...@praet.org id:1331149792-17192-1-git-send-email-pie...@praet.org --88888888888-- When executed on top of current master (c46764030d, 0.11.1-1-293-gc467640) last patch (1331149792-17192-1..., this I'm replying to) fails as: error: patch failed: test/notmuch-test:54 error: test/notmuch-test: patch does not apply In order to get clear picture of the changes you wish to get reviewed please provide cleanly applicable patchset. The best possible way to inform what is to be reviewed is 1) List of message id:s of the patches, in order those are to be applied. 2) Sha1 of the commit where this patchset applies cleanly (In this case I will do review even though it would not apply on top of current master (at that time) anymore -- but *I* would not expect it to to be pushed until rebased patchset is sent again). BR, Tomi ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v4] test: emacs: new test "notmuch-search: change tags of all matching messages"
* 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 at 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 000..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
[PATCH v4] test: emacs: new test notmuch-search: change tags of all matching messages
* 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@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 000..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 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch