unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
blob 81c284e983bc7e6fedbc776b634499cdc2f45204 9220 bytes (raw)
name: test/search-excludes 	 # 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
 
#!/usr/bin/env bash
test_description='"notmuch search" with excludes in several variations'
. ./test-lib.sh

# Generates a thread of 'length' messages. The subject of the nth
# message in the thread is 'subject: message n'
generate_thread ()
{
    local subject="$1"
    local length="$2"
    generate_message '[subject]="'"${subject}: message 1"'"'
    parent_id=$gen_msg_id
    for i in `seq 2 $length`
    do
	generate_message '[subject]="'"${subject}: message $i"'"' \
	                 "[in-reply-to]=\<$parent_id\>"
	parent_id=$gen_msg_id
    done
    notmuch new > /dev/null
}

# We construct some threads for the tests. We use the tag "test" to
# indicate which messages we will search for.

# A thread of deleted messages; test matches one of them.
generate_thread "All messages excluded: single match" 5
notmuch tag +deleted subject:"All messages excluded: single match*"
notmuch tag +test 'subject:All messages excluded: single match: message 2'

# A thread of deleted messages; test matches two of them.
generate_thread "All messages excluded: double match" 5
notmuch tag +deleted subject:"All messages excluded: double match*"
notmuch tag +test 'subject:All messages excluded: double match: message 2'
notmuch tag +test 'subject:All messages excluded: double match: message 4'

# A thread some messages deleted; test only matches a deleted message.
generate_thread "Some messages excluded: single excluded match" 5
notmuch tag +deleted +test 'subject:Some messages excluded: single excluded match: message 3'

# A thread some messages deleted; test only matches a non-deleted message.
generate_thread "Some messages excluded: single non-excluded match" 5
notmuch tag +deleted 'subject:Some messages excluded: single non-excluded match: message 2'
notmuch tag +test 'subject:Some messages excluded: single non-excluded match: message 4'

# A thread no messages deleted; test matches a message.
generate_thread "No messages excluded: single match" 5
notmuch tag +test 'subject:No messages excluded: single match: message 3'

# Set up excludes
notmuch config set search.exclude_tags deleted

test_begin_subtest "Default exclusion (thread summary)"
output=$(notmuch search tag:test | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single non-excluded match: message 4 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; No messages excluded: single match: message 3 (inbox test unread)"

test_begin_subtest "Default exclusion (messages)"
output=$(notmuch search --output=messages tag:test | notmuch_search_sanitize)
test_expect_equal "$output" "id:msg-019@notmuch-test-suite
id:msg-023@notmuch-test-suite"

test_begin_subtest "exclude=true (thread summary)"
output=$(notmuch search --exclude=true tag:test | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single non-excluded match: message 4 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; No messages excluded: single match: message 3 (inbox test unread)"

test_begin_subtest "exclude=true (messages)"
output=$(notmuch search --exclude=true --output=messages tag:test | notmuch_search_sanitize)
test_expect_equal "$output" "id:msg-019@notmuch-test-suite
id:msg-023@notmuch-test-suite"

test_begin_subtest "exclude=false (thread summary)"
output=$(notmuch search --exclude=false tag:test | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; All messages excluded: single match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single non-excluded match: message 4 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; No messages excluded: single match: message 3 (inbox test unread)"

test_begin_subtest "exclude=false (messages)"
output=$(notmuch search --exclude=false --output=messages tag:test | notmuch_search_sanitize)
test_expect_equal "$output" "id:msg-002@notmuch-test-suite
id:msg-007@notmuch-test-suite
id:msg-009@notmuch-test-suite
id:msg-013@notmuch-test-suite
id:msg-019@notmuch-test-suite
id:msg-023@notmuch-test-suite"

test_begin_subtest "exclude=flag (thread summary)"
output=$(notmuch search --exclude=flag tag:test | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [0/5] Notmuch Test Suite; All messages excluded: single match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [0/5] Notmuch Test Suite; All messages excluded: double match: message 4 (deleted inbox test unread)
thread:XXX   2001-01-05 [0/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single non-excluded match: message 4 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; No messages excluded: single match: message 3 (inbox test unread)"

test_begin_subtest "exclude=flag (messages)"
output=$(notmuch search --exclude=flag --output=messages tag:test | notmuch_search_sanitize)
test_expect_equal "$output" "id:msg-002@notmuch-test-suite
id:msg-007@notmuch-test-suite
id:msg-009@notmuch-test-suite
id:msg-013@notmuch-test-suite
id:msg-019@notmuch-test-suite
id:msg-023@notmuch-test-suite"

test_begin_subtest "Default exclusion: tag in query (thread summary)"
output=$(notmuch search tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; All messages excluded: single match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)"

test_begin_subtest "Default exclusion: tag in query (messages)"
output=$(notmuch search --output=messages tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "id:msg-002@notmuch-test-suite
id:msg-007@notmuch-test-suite
id:msg-009@notmuch-test-suite
id:msg-013@notmuch-test-suite"

test_begin_subtest "exclude=true: tag in query (thread summary)"
output=$(notmuch search --exclude=true tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; All messages excluded: single match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)"

test_begin_subtest "exclude=true: tag in query (messages)"
output=$(notmuch search --exclude=true --output=messages tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "id:msg-002@notmuch-test-suite
id:msg-007@notmuch-test-suite
id:msg-009@notmuch-test-suite
id:msg-013@notmuch-test-suite"

test_begin_subtest "exclude=false: tag in query (thread summary)"
output=$(notmuch search --exclude=false tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; All messages excluded: single match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)"

test_begin_subtest "exclude=false: tag in query (messages)"
output=$(notmuch search --exclude=false --output=messages tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "id:msg-002@notmuch-test-suite
id:msg-007@notmuch-test-suite
id:msg-009@notmuch-test-suite
id:msg-013@notmuch-test-suite"

test_begin_subtest "exclude=flag: tag in query (thread summary)"
output=$(notmuch search --exclude=flag tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; All messages excluded: single match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)
thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)"

test_begin_subtest "exclude=flag: tag in query (messages)"
output=$(notmuch search --exclude=flag --output=messages tag:test and tag:deleted | notmuch_search_sanitize)
test_expect_equal "$output" "id:msg-002@notmuch-test-suite
id:msg-007@notmuch-test-suite
id:msg-009@notmuch-test-suite
id:msg-013@notmuch-test-suite"



test_done

debug log:

solving 81c284e ...
found 81c284e in https://yhetil.org/notmuch/1332091381-16797-1-git-send-email-markwalters1009@gmail.com/

applying [1/1] https://yhetil.org/notmuch/1332091381-16797-1-git-send-email-markwalters1009@gmail.com/
diff --git a/test/search-excludes b/test/search-excludes
new file mode 100755
index 0000000..81c284e

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

index at:
100755 81c284e983bc7e6fedbc776b634499cdc2f45204	test/search-excludes

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