Re: [PATCH v4 02/16] Move crypto.c into libutil
[notmuch-archives.git] / 91 / 99fd750af3f715c4c52471b3fa75ff7a452b25
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 8C8F0431FB6\r
6         for <notmuch@notmuchmail.org>; Sun, 18 Mar 2012 10:23:08 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id hfMv+QflixxX for <notmuch@notmuchmail.org>;\r
18         Sun, 18 Mar 2012 10:23:07 -0700 (PDT)\r
19 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
20         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 286DA431FAF\r
23         for <notmuch@notmuchmail.org>; Sun, 18 Mar 2012 10:23:07 -0700 (PDT)\r
24 Received: by werm13 with SMTP id m13so6039192wer.26\r
25         for <notmuch@notmuchmail.org>; Sun, 18 Mar 2012 10:23:04 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=mwnElj3aj0E3OAL7/9S79Dkzml/fQGY9nS75gBM7DFg=;\r
29         b=dUrQhslfUtVnhhFX/2W4frfcWs7YDlG88rMei26Ie5MW/vwxeUu+Q0HhhrAucjLzZk\r
30         l35H3vCLngHoZacjT72FEIflGJwMKmO4v1VxWykJ4gOqZVRvlVeEVQj4B19kmxnq5XsM\r
31         YL1vOvlzUzmlsf+44i0/cTHJ1U32bBQVDrFLZqNPvlBkhkuhgej6brGSeA6YFGjzaLBk\r
32         gZ7cn1cfdy3l3bo5bhhg4MA8padJy1+yhktOd5PEkczdwiRSYe6V7gRFxv2kyq7zD5XZ\r
33         HSyqrdCDwkLg7D9LIjZGsUVxdv8Cu2ZrHR3PWdxQM/7+iuay/D/ezj3zAwmRgM2ngalC\r
34         KsPw==\r
35 Received: by 10.180.80.104 with SMTP id q8mr13538470wix.14.1332091384369;\r
36         Sun, 18 Mar 2012 10:23:04 -0700 (PDT)\r
37 Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
38  [94.192.233.223])      by mx.google.com with ESMTPS id\r
39  df3sm18397976wib.1.2012.03.18.10.23.02 (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sun, 18 Mar 2012 10:23:03 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH] test: add some exclude tests\r
44 Date: Sun, 18 Mar 2012 17:23:01 +0000\r
45 Message-Id: <1332091381-16797-1-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 1.7.9.1\r
47 In-Reply-To: <20120317155023.GH2670@mit.edu>\r
48 References: <20120317155023.GH2670@mit.edu>\r
49 X-BeenThere: notmuch@notmuchmail.org\r
50 X-Mailman-Version: 2.1.13\r
51 Precedence: list\r
52 List-Id: "Use and development of the notmuch mail system."\r
53         <notmuch.notmuchmail.org>\r
54 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
56 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
57 List-Post: <mailto:notmuch@notmuchmail.org>\r
58 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
59 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
61 X-List-Received-Date: Sun, 18 Mar 2012 17:23:08 -0000\r
62 \r
63 Here are some tests for search exclude working in a systematic fashion\r
64 as suggested by Austin.\r
65 \r
66 In principle I think something like the generate_thread function could\r
67 go in to test-lib.sh, but it would need to be written by someone much\r
68 familiar with bash quoting than I am.\r
69 \r
70 At the moment I have left the current exclude tests in the "search"\r
71 test: should they be moved here?\r
72 \r
73 Best wishes \r
74 \r
75 Mark\r
76 \r
77 ---\r
78  test/notmuch-test    |    1 +\r
79  test/search-excludes |  160 ++++++++++++++++++++++++++++++++++++++++++++++++++\r
80  2 files changed, 161 insertions(+), 0 deletions(-)\r
81  create mode 100755 test/search-excludes\r
82 \r
83 diff --git a/test/notmuch-test b/test/notmuch-test\r
84 index f03b594..4dcd8c6 100755\r
85 --- a/test/notmuch-test\r
86 +++ b/test/notmuch-test\r
87 @@ -27,6 +27,7 @@ TESTS="\r
88    search-position-overlap-bug\r
89    search-insufficient-from-quoting\r
90    search-limiting\r
91 +  search-excludes\r
92    tagging\r
93    json\r
94    multipart\r
95 diff --git a/test/search-excludes b/test/search-excludes\r
96 new file mode 100755\r
97 index 0000000..81c284e\r
98 --- /dev/null\r
99 +++ b/test/search-excludes\r
100 @@ -0,0 +1,160 @@\r
101 +#!/usr/bin/env bash\r
102 +test_description='"notmuch search" with excludes in several variations'\r
103 +. ./test-lib.sh\r
104 +\r
105 +# Generates a thread of 'length' messages. The subject of the nth\r
106 +# message in the thread is 'subject: message n'\r
107 +generate_thread ()\r
108 +{\r
109 +    local subject="$1"\r
110 +    local length="$2"\r
111 +    generate_message '[subject]="'"${subject}: message 1"'"'\r
112 +    parent_id=$gen_msg_id\r
113 +    for i in `seq 2 $length`\r
114 +    do\r
115 +       generate_message '[subject]="'"${subject}: message $i"'"' \\r
116 +                        "[in-reply-to]=\<$parent_id\>"\r
117 +       parent_id=$gen_msg_id\r
118 +    done\r
119 +    notmuch new > /dev/null\r
120 +}\r
121 +\r
122 +# We construct some threads for the tests. We use the tag "test" to\r
123 +# indicate which messages we will search for.\r
124 +\r
125 +# A thread of deleted messages; test matches one of them.\r
126 +generate_thread "All messages excluded: single match" 5\r
127 +notmuch tag +deleted subject:"All messages excluded: single match*"\r
128 +notmuch tag +test 'subject:All messages excluded: single match: message 2'\r
129 +\r
130 +# A thread of deleted messages; test matches two of them.\r
131 +generate_thread "All messages excluded: double match" 5\r
132 +notmuch tag +deleted subject:"All messages excluded: double match*"\r
133 +notmuch tag +test 'subject:All messages excluded: double match: message 2'\r
134 +notmuch tag +test 'subject:All messages excluded: double match: message 4'\r
135 +\r
136 +# A thread some messages deleted; test only matches a deleted message.\r
137 +generate_thread "Some messages excluded: single excluded match" 5\r
138 +notmuch tag +deleted +test 'subject:Some messages excluded: single excluded match: message 3'\r
139 +\r
140 +# A thread some messages deleted; test only matches a non-deleted message.\r
141 +generate_thread "Some messages excluded: single non-excluded match" 5\r
142 +notmuch tag +deleted 'subject:Some messages excluded: single non-excluded match: message 2'\r
143 +notmuch tag +test 'subject:Some messages excluded: single non-excluded match: message 4'\r
144 +\r
145 +# A thread no messages deleted; test matches a message.\r
146 +generate_thread "No messages excluded: single match" 5\r
147 +notmuch tag +test 'subject:No messages excluded: single match: message 3'\r
148 +\r
149 +# Set up excludes\r
150 +notmuch config set search.exclude_tags deleted\r
151 +\r
152 +test_begin_subtest "Default exclusion (thread summary)"\r
153 +output=$(notmuch search tag:test | notmuch_search_sanitize)\r
154 +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)\r
155 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; No messages excluded: single match: message 3 (inbox test unread)"\r
156 +\r
157 +test_begin_subtest "Default exclusion (messages)"\r
158 +output=$(notmuch search --output=messages tag:test | notmuch_search_sanitize)\r
159 +test_expect_equal "$output" "id:msg-019@notmuch-test-suite\r
160 +id:msg-023@notmuch-test-suite"\r
161 +\r
162 +test_begin_subtest "exclude=true (thread summary)"\r
163 +output=$(notmuch search --exclude=true tag:test | notmuch_search_sanitize)\r
164 +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)\r
165 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; No messages excluded: single match: message 3 (inbox test unread)"\r
166 +\r
167 +test_begin_subtest "exclude=true (messages)"\r
168 +output=$(notmuch search --exclude=true --output=messages tag:test | notmuch_search_sanitize)\r
169 +test_expect_equal "$output" "id:msg-019@notmuch-test-suite\r
170 +id:msg-023@notmuch-test-suite"\r
171 +\r
172 +test_begin_subtest "exclude=false (thread summary)"\r
173 +output=$(notmuch search --exclude=false tag:test | notmuch_search_sanitize)\r
174 +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)\r
175 +thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)\r
176 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)\r
177 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single non-excluded match: message 4 (deleted inbox test unread)\r
178 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; No messages excluded: single match: message 3 (inbox test unread)"\r
179 +\r
180 +test_begin_subtest "exclude=false (messages)"\r
181 +output=$(notmuch search --exclude=false --output=messages tag:test | notmuch_search_sanitize)\r
182 +test_expect_equal "$output" "id:msg-002@notmuch-test-suite\r
183 +id:msg-007@notmuch-test-suite\r
184 +id:msg-009@notmuch-test-suite\r
185 +id:msg-013@notmuch-test-suite\r
186 +id:msg-019@notmuch-test-suite\r
187 +id:msg-023@notmuch-test-suite"\r
188 +\r
189 +test_begin_subtest "exclude=flag (thread summary)"\r
190 +output=$(notmuch search --exclude=flag tag:test | notmuch_search_sanitize)\r
191 +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)\r
192 +thread:XXX   2001-01-05 [0/5] Notmuch Test Suite; All messages excluded: double match: message 4 (deleted inbox test unread)\r
193 +thread:XXX   2001-01-05 [0/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)\r
194 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single non-excluded match: message 4 (deleted inbox test unread)\r
195 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; No messages excluded: single match: message 3 (inbox test unread)"\r
196 +\r
197 +test_begin_subtest "exclude=flag (messages)"\r
198 +output=$(notmuch search --exclude=flag --output=messages tag:test | notmuch_search_sanitize)\r
199 +test_expect_equal "$output" "id:msg-002@notmuch-test-suite\r
200 +id:msg-007@notmuch-test-suite\r
201 +id:msg-009@notmuch-test-suite\r
202 +id:msg-013@notmuch-test-suite\r
203 +id:msg-019@notmuch-test-suite\r
204 +id:msg-023@notmuch-test-suite"\r
205 +\r
206 +test_begin_subtest "Default exclusion: tag in query (thread summary)"\r
207 +output=$(notmuch search tag:test and tag:deleted | notmuch_search_sanitize)\r
208 +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)\r
209 +thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)\r
210 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)"\r
211 +\r
212 +test_begin_subtest "Default exclusion: tag in query (messages)"\r
213 +output=$(notmuch search --output=messages tag:test and tag:deleted | notmuch_search_sanitize)\r
214 +test_expect_equal "$output" "id:msg-002@notmuch-test-suite\r
215 +id:msg-007@notmuch-test-suite\r
216 +id:msg-009@notmuch-test-suite\r
217 +id:msg-013@notmuch-test-suite"\r
218 +\r
219 +test_begin_subtest "exclude=true: tag in query (thread summary)"\r
220 +output=$(notmuch search --exclude=true tag:test and tag:deleted | notmuch_search_sanitize)\r
221 +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)\r
222 +thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)\r
223 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)"\r
224 +\r
225 +test_begin_subtest "exclude=true: tag in query (messages)"\r
226 +output=$(notmuch search --exclude=true --output=messages tag:test and tag:deleted | notmuch_search_sanitize)\r
227 +test_expect_equal "$output" "id:msg-002@notmuch-test-suite\r
228 +id:msg-007@notmuch-test-suite\r
229 +id:msg-009@notmuch-test-suite\r
230 +id:msg-013@notmuch-test-suite"\r
231 +\r
232 +test_begin_subtest "exclude=false: tag in query (thread summary)"\r
233 +output=$(notmuch search --exclude=false tag:test and tag:deleted | notmuch_search_sanitize)\r
234 +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)\r
235 +thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)\r
236 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)"\r
237 +\r
238 +test_begin_subtest "exclude=false: tag in query (messages)"\r
239 +output=$(notmuch search --exclude=false --output=messages tag:test and tag:deleted | notmuch_search_sanitize)\r
240 +test_expect_equal "$output" "id:msg-002@notmuch-test-suite\r
241 +id:msg-007@notmuch-test-suite\r
242 +id:msg-009@notmuch-test-suite\r
243 +id:msg-013@notmuch-test-suite"\r
244 +\r
245 +test_begin_subtest "exclude=flag: tag in query (thread summary)"\r
246 +output=$(notmuch search --exclude=flag tag:test and tag:deleted | notmuch_search_sanitize)\r
247 +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)\r
248 +thread:XXX   2001-01-05 [2/5] Notmuch Test Suite; All messages excluded: double match: message 2 (deleted inbox test unread)\r
249 +thread:XXX   2001-01-05 [1/5] Notmuch Test Suite; Some messages excluded: single excluded match: message 3 (deleted inbox test unread)"\r
250 +\r
251 +test_begin_subtest "exclude=flag: tag in query (messages)"\r
252 +output=$(notmuch search --exclude=flag --output=messages tag:test and tag:deleted | notmuch_search_sanitize)\r
253 +test_expect_equal "$output" "id:msg-002@notmuch-test-suite\r
254 +id:msg-007@notmuch-test-suite\r
255 +id:msg-009@notmuch-test-suite\r
256 +id:msg-013@notmuch-test-suite"\r
257 +\r
258 +\r
259 +\r
260 +test_done\r
261 -- \r
262 1.7.9.1\r
263 \r