]> git.notmuchmail.org Git - notmuch/blob - test/T461-emacs-search-exclude.sh
emacs: Add new option notmuch-search-hide-excluded
[notmuch] / test / T461-emacs-search-exclude.sh
1 #!/usr/bin/env bash
2
3 test_description="exclude options persist between Emacs search and tree modes"
4 . $(dirname "$0")/test-lib.sh || exit 1
5 . $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
6
7 EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
8
9 test_require_emacs
10 add_email_corpus
11 notmuch config set search.exclude_tags deleted
12 notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
13
14 # Basic test cases just asserting exclude option is working and consistent.
15
16 test_begin_subtest "Search doesn't contain excluded mail by default"
17 test_emacs '(notmuch-hello)
18             (goto-char (point-min))
19             (re-search-forward "inbox")
20             (widget-button-press (1- (point)))
21             (notmuch-test-wait)
22             (test-output)
23             (delete-other-windows)'
24 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
25
26 test_begin_subtest "Toggling exclude in search will show excluded mail"
27 test_emacs '(notmuch-hello)
28             (goto-char (point-min))
29             (re-search-forward "inbox")
30             (widget-button-press (1- (point)))
31             (notmuch-test-wait)
32             (notmuch-search-toggle-hide-excluded)
33             (notmuch-test-wait)
34             (test-output)
35             (delete-other-windows)'
36 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
37
38 test_begin_subtest "Tree search doesn't contain excluded mail by default"
39 test_emacs '(notmuch-hello)
40             (goto-char (point-min))
41             (re-search-forward "inbox")
42             (widget-button-press (1- (point)))
43             (notmuch-test-wait)
44             (notmuch-tree-from-search-current-query)
45             (notmuch-test-wait)
46             (test-output)
47             (delete-other-windows)'
48 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
49
50 test_begin_subtest "Toggling exclude in tree search will show excluded mail"
51 test_emacs '(notmuch-hello)
52             (goto-char (point-min))
53             (re-search-forward "inbox")
54             (widget-button-press (1- (point)))
55             (notmuch-test-wait)
56             (notmuch-tree-from-search-current-query)
57             (notmuch-test-wait)
58             (notmuch-tree-toggle-hide-excluded)
59             (notmuch-test-wait)
60             (test-output)
61             (delete-other-windows)'
62 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
63
64 test_begin_subtest "Unthreaded search doesn't contain excluded mail by default"
65 test_emacs '(notmuch-hello)
66             (goto-char (point-min))
67             (re-search-forward "inbox")
68             (widget-button-press (1- (point)))
69             (notmuch-test-wait)
70             (notmuch-unthreaded-from-search-current-query)
71             (notmuch-test-wait)
72             (test-output)
73             (delete-other-windows)'
74 test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-without-excluded OUTPUT
75
76 test_begin_subtest "Toggling exclude in unthreaded will show excluded mail"
77 test_emacs '(notmuch-hello)
78             (goto-char (point-min))
79             (re-search-forward "inbox")
80             (widget-button-press (1- (point)))
81             (notmuch-test-wait)
82             (notmuch-unthreaded-from-search-current-query)
83             (notmuch-test-wait)
84             (notmuch-tree-toggle-hide-excluded)
85             (notmuch-test-wait)
86             (test-output)
87             (delete-other-windows)'
88 test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
89
90 # Cycling from search to tree to unthreaded and vice versa will persist the current
91 # value of notmuch-search-hide-excluded.
92
93 test_begin_subtest "Value of hide-excluded from search persists into tree search"
94 test_emacs '(notmuch-hello)
95             (goto-char (point-min))
96             (re-search-forward "inbox")
97             (widget-button-press (1- (point)))
98             (notmuch-test-wait)
99             (notmuch-search-toggle-hide-excluded)
100             (notmuch-test-wait)
101             (notmuch-tree-from-search-current-query)
102             (notmuch-test-wait)
103             (test-output)
104             (delete-other-windows)'
105 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
106
107 test_begin_subtest "Value of hide-excluded from search persists into unthreaded"
108 test_emacs '(notmuch-hello)
109             (goto-char (point-min))
110             (re-search-forward "inbox")
111             (widget-button-press (1- (point)))
112             (notmuch-test-wait)
113             (notmuch-search-toggle-hide-excluded)
114             (notmuch-test-wait)
115             (notmuch-unthreaded-from-search-current-query)
116             (notmuch-test-wait)
117             (test-output)
118             (delete-other-windows)'
119 test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
120
121 test_begin_subtest "Value of hide-excluded from tree persists into search"
122 test_emacs '(notmuch-hello)
123             (goto-char (point-min))
124             (re-search-forward "inbox")
125             (widget-button-press (1- (point)))
126             (notmuch-test-wait)
127             (notmuch-tree-from-search-current-query)
128             (notmuch-test-wait)
129             (notmuch-tree-toggle-hide-excluded)
130             (notmuch-test-wait)
131             (notmuch-search-from-tree-current-query)
132             (notmuch-test-wait)
133             (test-output)
134             (delete-other-windows)'
135 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
136
137 test_begin_subtest "Value of hide-excluded from tree persists into unthreaded"
138 test_emacs '(notmuch-hello)
139             (goto-char (point-min))
140             (re-search-forward "inbox")
141             (widget-button-press (1- (point)))
142             (notmuch-test-wait)
143             (notmuch-tree-from-search-current-query)
144             (notmuch-test-wait)
145             (notmuch-tree-toggle-hide-excluded)
146             (notmuch-test-wait)
147             (notmuch-unthreaded-from-tree-current-query)
148             (notmuch-test-wait)
149             (test-output)
150             (delete-other-windows)'
151 test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
152
153 test_begin_subtest "Value of hide-excluded from unthreaded persists into tree"
154 test_emacs '(notmuch-hello)
155             (goto-char (point-min))
156             (re-search-forward "inbox")
157             (widget-button-press (1- (point)))
158             (notmuch-test-wait)
159             (notmuch-unthreaded-from-search-current-query)
160             (notmuch-test-wait)
161             (notmuch-tree-toggle-hide-excluded)
162             (notmuch-test-wait)
163             (notmuch-tree-from-unthreaded-current-query)
164             (notmuch-test-wait)
165             (test-output)
166             (delete-other-windows)'
167 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
168
169 test_begin_subtest "Value of hide-excluded from unthreaded persists into search"
170 test_emacs '(notmuch-hello)
171             (goto-char (point-min))
172             (re-search-forward "inbox")
173             (widget-button-press (1- (point)))
174             (notmuch-test-wait)
175             (notmuch-unthreaded-from-search-current-query)
176             (notmuch-test-wait)
177             (notmuch-tree-toggle-hide-excluded)
178             (notmuch-test-wait)
179             (notmuch-search-from-tree-current-query)
180             (notmuch-test-wait)
181             (test-output)
182             (delete-other-windows)'
183 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
184
185 test_done