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
7 EXPECTED=$NOTMUCH_SRCDIR/test/emacs-exclude.expected-output
11 notmuch config set search.exclude_tags deleted
12 notmuch tag +deleted -- 'from:"Stewart Smith"' or 'from:"Chris Wilson"'
14 # Basic test cases just asserting exclude option is working and consistent.
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)))
23 (delete-other-windows)'
24 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-without-excluded OUTPUT
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)))
32 (notmuch-search-toggle-hide-excluded)
35 (delete-other-windows)'
36 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
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)))
44 (notmuch-tree-from-search-current-query)
47 (delete-other-windows)'
48 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-without-excluded OUTPUT
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)))
56 (notmuch-tree-from-search-current-query)
58 (notmuch-tree-toggle-hide-excluded)
61 (delete-other-windows)'
62 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
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)))
70 (notmuch-unthreaded-from-search-current-query)
73 (delete-other-windows)'
74 test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-without-excluded OUTPUT
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)))
82 (notmuch-unthreaded-from-search-current-query)
84 (notmuch-tree-toggle-hide-excluded)
87 (delete-other-windows)'
88 test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
90 # Cycling from search to tree to unthreaded and vice versa will persist the current
91 # value of notmuch-search-hide-excluded.
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)))
99 (notmuch-search-toggle-hide-excluded)
101 (notmuch-tree-from-search-current-query)
104 (delete-other-windows)'
105 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
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)))
113 (notmuch-search-toggle-hide-excluded)
115 (notmuch-unthreaded-from-search-current-query)
118 (delete-other-windows)'
119 test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
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)))
127 (notmuch-tree-from-search-current-query)
129 (notmuch-tree-toggle-hide-excluded)
131 (notmuch-search-from-tree-current-query)
134 (delete-other-windows)'
135 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT
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)))
143 (notmuch-tree-from-search-current-query)
145 (notmuch-tree-toggle-hide-excluded)
147 (notmuch-unthreaded-from-tree-current-query)
150 (delete-other-windows)'
151 test_expect_equal_file $EXPECTED/notmuch-unthreaded-tag-inbox-with-excluded OUTPUT
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)))
159 (notmuch-unthreaded-from-search-current-query)
161 (notmuch-tree-toggle-hide-excluded)
163 (notmuch-tree-from-unthreaded-current-query)
166 (delete-other-windows)'
167 test_expect_equal_file $EXPECTED/notmuch-tree-tag-inbox-with-excluded OUTPUT
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)))
175 (notmuch-unthreaded-from-search-current-query)
177 (notmuch-tree-toggle-hide-excluded)
179 (notmuch-search-from-tree-current-query)
182 (delete-other-windows)'
183 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox-with-excluded OUTPUT