unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob e1ac4321980a3421effc669c1fc861427e04d61b 6788 bytes (raw)
name: test/T461-emacs-search-exclude.sh 	 # 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
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
 
#!/usr/bin/env bash

test_description="exclude options persist between Emacs search and tree modes"
. $(dirname "$0")/test-lib.sh || exit 1
. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1

EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output

test_require_emacs
add_email_corpus
notmuch config set search.exclude_tags deleted
notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'

# Basic test cases just asserting exclude option is working and consistent.

test_begin_subtest "Search doesn't contain excluded mail by default"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT

test_begin_subtest "Toggling exclude in search will show excluded mail"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
      (notmuch-search-toggle-hide-excluded)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT

test_begin_subtest "Tree search doesn't contain excluded mail by default"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (notmuch-tree-from-search-current-query)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT

test_begin_subtest "Toggling exclude in tree search will show excluded mail"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (notmuch-tree-from-search-current-query)
	    (notmuch-test-wait)
      (notmuch-tree-toggle-hide-excluded)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT

test_begin_subtest "Unthreaded search doesn't contain excluded mail by default"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (notmuch-unthreaded-from-search-current-query)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-without-excluded OUTPUT

test_begin_subtest "Toggling exclude in unthreaded will show excluded mail"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (notmuch-unthreaded-from-search-current-query)
	    (notmuch-test-wait)
      (notmuch-tree-toggle-hide-excluded)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT

# Cycling from search to tree to unthreaded and vice versa will persist the current
# value of notmuch-search-hide-excluded.

test_begin_subtest "Value of hide-excluded from search persists into tree search"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
      (notmuch-search-toggle-hide-excluded)
	    (notmuch-test-wait)
	    (notmuch-tree-from-search-current-query)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT

test_begin_subtest "Value of hide-excluded from search persists into unthreaded"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
      (notmuch-search-toggle-hide-excluded)
	    (notmuch-test-wait)
	    (notmuch-unthreaded-from-search-current-query)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT

test_begin_subtest "Value of hide-excluded from tree persists into search"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (notmuch-tree-from-search-current-query)
	    (notmuch-test-wait)
      (notmuch-tree-toggle-hide-excluded)
	    (notmuch-test-wait)
	    (notmuch-search-from-tree-current-query)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT

test_begin_subtest "Value of hide-excluded from tree persists into unthreaded"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (notmuch-tree-from-search-current-query)
	    (notmuch-test-wait)
      (notmuch-tree-toggle-hide-excluded)
	    (notmuch-test-wait)
	    (notmuch-unthreaded-from-tree-current-query)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT

test_begin_subtest "Value of hide-excluded from unthreaded persists into tree"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (notmuch-unthreaded-from-search-current-query)
	    (notmuch-test-wait)
      (notmuch-tree-toggle-hide-excluded)
	    (notmuch-test-wait)
      (notmuch-tree-from-unthreaded-current-query)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT

test_begin_subtest "Value of hide-excluded from unthreaded persists into search"
test_emacs '(notmuch-hello)
	    (goto-char (point-min))
	    (re-search-forward "inbox")
	    (widget-button-press (1- (point)))
	    (notmuch-test-wait)
	    (notmuch-unthreaded-from-search-current-query)
	    (notmuch-test-wait)
      (notmuch-tree-toggle-hide-excluded)
	    (notmuch-test-wait)
      (notmuch-search-from-tree-current-query)
	    (notmuch-test-wait)
	    (test-output)
	    (delete-other-windows)'
test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT

test_done

debug log:

solving 70882a7b ...
found 70882a7b in https://yhetil.org/notmuch/20230416131811.658253-4-mohkale@kisara.moe/ ||
	https://yhetil.org/notmuch/20240310185746.92516-1-mohkale@kisara.moe/

applying [1/1] https://yhetil.org/notmuch/20230416131811.658253-4-mohkale@kisara.moe/
diff --git a/test/T461-emacs-search-exclude.sh b/test/T461-emacs-search-exclude.sh\r
new file mode 100755\r
index 00000000..70882a7b\r

1:7: trailing whitespace.
#!/usr/bin/env bash\r
1:8: trailing whitespace.
\r
1:9: trailing whitespace.
test_description="exclude options persist between Emacs search and tree modes"\r
1:10: trailing whitespace.
. $(dirname "$0")/test-lib.sh || exit 1\r
1:11: trailing whitespace.
. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1\r
Checking patch test/T461-emacs-search-exclude.sh...
Applied patch test/T461-emacs-search-exclude.sh cleanly.
warning: squelched 180 whitespace errors
warning: 185 lines add whitespace errors.

skipping https://yhetil.org/notmuch/20240310185746.92516-1-mohkale@kisara.moe/ for 70882a7b
index at:
100755 e1ac4321980a3421effc669c1fc861427e04d61b	test/T461-emacs-search-exclude.sh

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