unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 1cd8a89f9280460339da178bcdf4b95e85305190 1640 bytes (raw)
name: test/emacs-search 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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

debug log:

solving 1cd8a89 ...
found 1cd8a89 in https://yhetil.org/notmuch/1331149792-17192-1-git-send-email-pieter@praet.org/

applying [1/1] https://yhetil.org/notmuch/1331149792-17192-1-git-send-email-pieter@praet.org/
diff --git a/test/emacs-search b/test/emacs-search
new file mode 100755
index 0000000..1cd8a89

Checking patch test/emacs-search...
Applied patch test/emacs-search cleanly.

index at:
100755 1cd8a89f9280460339da178bcdf4b95e85305190	test/emacs-search

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

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).