]> git.notmuchmail.org Git - notmuch/blob - test/notmuch-test
Merge bugfix for test-suite correctness.
[notmuch] / test / notmuch-test
1 #!/bin/bash
2 set -e
3
4 find_notmuch_binary ()
5 {
6     dir=$1
7
8     while [ -n "$dir" ]; do
9         bin=$dir/notmuch
10         if [ -x $bin ]; then
11             echo $bin
12             return
13         fi
14         dir=$(dirname $dir)
15         if [ "$dir" = "/" ]; then
16             break
17         fi
18     done
19
20     echo notmuch
21 }
22
23 increment_mtime_amount=0
24 increment_mtime ()
25 {
26     dir=$1
27
28     increment_mtime_amount=$((increment_mtime_amount + 1))
29     touch -d "+${increment_mtime_amount} seconds" $dir
30 }
31
32 # Generate a new message in the mail directory, with a unique message
33 # ID and subject. The message is not added to the index.
34 #
35 # After this function returns, the filename of the generated message
36 # is available as $gen_msg_filename and the message ID is available as
37 # $gen_msg_id .
38 #
39 # This function supports named parameters with the bash syntax for
40 # assigning a value to an associative array ([name]=value). The
41 # supported parameters are:
42 #
43 #  [dir]=directory/of/choice
44 #
45 #       Generate the message in directory 'directory/of/choice' within
46 #       the mail store. The directory will be created if necessary.
47 #
48 #  [body]=text
49 #
50 #       Text to use as the body of the email message
51 #
52 #  '[from]="Some User <user@example.com>"'
53 #  '[to]="Some User <user@example.com>"'
54 #  '[subject]="Subject of email message"'
55 #  '[date]="RFC 822 Date"'
56 #
57 #       Values for email headers. If not provided, default values will
58 #       be generated instead.
59 #
60 #  '[cc]="Some User <user@example.com>"'
61 #  [reply-to]=some-address
62 #  [in-reply-to]=<message-id>
63 #
64 #       Additional values for email headers. If these are not provided
65 #       then the relevant headers will simply not appear in the
66 #       message.
67 #
68 #  '[id]=<message-id>'
69 #
70 #       Controls the message-id of the created message.
71 gen_msg_cnt=0
72 gen_msg_filename=""
73 gen_msg_id=""
74 generate_message ()
75 {
76     # This is our (bash-specific) magic for doing named parameters
77     local -A template="($@)"
78     local additional_headers
79
80     if [ -z "${template[id]}" ]; then
81         gen_msg_cnt=$((gen_msg_cnt + 1))
82         gen_msg_name=msg-$(printf "%03d" $gen_msg_cnt)
83         gen_msg_id="${gen_msg_name}@notmuch-test-suite"
84     else
85         gen_msg_name="msg-${template[id]}"
86         gen_msg_id="${template[id]}"
87     fi
88
89     if [ -z "${template[dir]}" ]; then
90         gen_msg_filename="${MAIL_DIR}/$gen_msg_name"
91     else
92         gen_msg_filename="${MAIL_DIR}/${template[dir]}/$gen_msg_name"
93         mkdir -p $(dirname $gen_msg_filename)
94     fi
95
96     if [ -z "${template[body]}" ]; then
97         template[body]="This is just a test message at ${gen_msg_filename}"
98     fi
99
100     if [ -z "${template[from]}" ]; then
101         template[from]="Notmuch Test Suite <test_suite@notmuchmail.org>"
102     fi
103
104     if [ -z "${template[to]}" ]; then
105         template[to]="Notmuch Test Suite <test_suite@notmuchmail.org>"
106     fi
107
108     if [ -z "${template[subject]}" ]; then
109         template[subject]="Test message ${gen_msg_filename}"
110     fi
111
112     if [ -z "${template[date]}" ]; then
113         template[date]="Tue, 05 Jan 2010 15:43:57 -0800"
114     fi
115
116     additional_headers=""
117     if [ ! -z "${template[reply-to]}" ]; then
118         additional_headers="Reply-To: ${template[reply-to]}
119 ${additional_headers}"
120     fi
121
122     if [ ! -z "${template[in-reply-to]}" ]; then
123         additional_headers="In-Reply-To: ${template[in-reply-to]}
124 ${additional_headers}"
125     fi
126
127     if [ ! -z "${template[cc]}" ]; then
128         additional_headers="Cc: ${template[cc]}
129 ${additional_headers}"
130     fi
131
132 cat <<EOF >$gen_msg_filename
133 From: ${template[from]}
134 To: ${template[to]}
135 Message-Id: <${gen_msg_id}>
136 Subject: ${template[subject]}
137 Date: ${template[date]}
138 ${additional_headers}
139 ${template[body]}
140 EOF
141
142     # Ensure that the mtime of the containing directory is updated
143     increment_mtime $(dirname ${gen_msg_filename})
144 }
145
146 # Generate a new message and add it to the index.
147 #
148 # All of the arguments and return values supported by generate_message
149 # are alos supported here, so see that function for details.
150 add_message ()
151 {
152     generate_message "$@"
153
154     $NOTMUCH new > /dev/null
155 }
156
157 NOTMUCH_IGNORED_OUTPUT_REGEXP='^Processed [0-9]*( total)? file|Found [0-9]* total file'
158 NOTMUCH_THREAD_ID_SQUELCH='s/thread:................/thread:XXX/'
159 execute_expecting ()
160 {
161     args=$1
162     expected=$2
163
164     output=$($NOTMUCH $args | grep -v -E -e "$NOTMUCH_IGNORED_OUTPUT_REGEXP" | sed -e "$NOTMUCH_THREAD_ID_SQUELCH" || true)
165     if [ "$output" = "$expected" ]; then
166         echo "  PASS"
167     else
168         echo "  FAIL"
169         echo "  Expected output: $expected"
170         echo "  Actual output:   $output"
171     fi
172 }
173
174 TEST_DIR=$(pwd)/test.$$
175 MAIL_DIR=${TEST_DIR}/mail
176 export NOTMUCH_CONFIG=${TEST_DIR}/notmuch-config
177 NOTMUCH=$(find_notmuch_binary $(pwd))
178
179 rm -rf ${TEST_DIR}
180 mkdir ${TEST_DIR}
181 cd ${TEST_DIR}
182
183 mkdir ${MAIL_DIR}
184
185 cat <<EOF > ${NOTMUCH_CONFIG}
186 [database]
187 path=${MAIL_DIR}
188
189 [user]
190 name=Notmuch Test Suite
191 primary_email=test_suite@notmuchmail.org
192 other_email=test_suite_other@notmuchmail.org
193 EOF
194
195 printf "Testing \"notmuch new\" in several variations:\n"
196 printf " No new messages...\t\t"
197 execute_expecting new "No new mail."
198
199 printf " Single new message...\t\t"
200 generate_message
201 execute_expecting new "Added 1 new message to the database."
202
203 printf " Multiple new messages...\t"
204 generate_message
205 generate_message
206 execute_expecting new "Added 2 new messages to the database."
207
208 printf " No new messages (non-empty DB)... "
209 execute_expecting new "No new mail."
210
211 printf " New directories...\t\t"
212 rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
213 mkdir ${MAIL_DIR}/def
214 mkdir ${MAIL_DIR}/ghi
215 generate_message [dir]=def
216
217 execute_expecting new "Added 1 new message to the database."
218
219 printf " Alternate inode order...\t"
220
221 rm -rf ${MAIL_DIR}/.notmuch
222 mv ${MAIL_DIR}/ghi ${MAIL_DIR}/abc
223 rm ${MAIL_DIR}/def/*
224 generate_message [dir]=abc
225
226 execute_expecting new "Added 1 new message to the database."
227
228 printf " Message moved in...\t\t"
229 rm -rf ${MAIL_DIR}/* ${MAIL_DIR}/.notmuch
230 generate_message
231 tmp_msg_filename=tmp/$gen_msg_filename
232 mkdir -p $(dirname $tmp_msg_filename)
233 mv $gen_msg_filename $tmp_msg_filename
234 increment_mtime ${MAIL_DIR}
235 $NOTMUCH new > /dev/null
236 mv $tmp_msg_filename $gen_msg_filename
237 increment_mtime ${MAIL_DIR}
238 execute_expecting new "Added 1 new message to the database."
239
240 printf " Renamed message...\t\t"
241
242 generate_message
243 $NOTMUCH new > /dev/null
244 mv $gen_msg_filename ${gen_msg_filename}-renamed
245 increment_mtime ${MAIL_DIR}
246 execute_expecting new "No new mail. Detected 1 file rename."
247
248 printf " Deleted message...\t\t"
249
250 rm ${gen_msg_filename}-renamed
251 increment_mtime ${MAIL_DIR}
252 execute_expecting new "No new mail. Removed 1 message."
253
254 printf " Renamed directory...\t\t"
255
256 generate_message [dir]=dir
257 generate_message [dir]=dir
258 generate_message [dir]=dir
259
260 $NOTMUCH new > /dev/null
261
262 mv ${MAIL_DIR}/dir ${MAIL_DIR}/dir-renamed
263 increment_mtime ${MAIL_DIR}
264
265 execute_expecting new "No new mail. Detected 3 file renames."
266
267 printf " Deleted directory...\t\t"
268
269 rm -rf ${MAIL_DIR}/dir-renamed
270 increment_mtime ${MAIL_DIR}
271
272 execute_expecting new "No new mail. Removed 3 messages."
273
274 printf " New directory (at end of list)... "
275
276 generate_message [dir]=zzz
277 generate_message [dir]=zzz
278 generate_message [dir]=zzz
279
280 execute_expecting new "Added 3 new messages to the database."
281
282 printf " Deleted directory (end of list)... "
283
284 rm -rf ${MAIL_DIR}/zzz
285 increment_mtime ${MAIL_DIR}
286
287 execute_expecting new "No new mail. Removed 3 messages."
288
289 printf " New symlink to directory...\t"
290
291 rm -rf ${MAIL_DIR}/.notmuch
292 mv ${MAIL_DIR} ${TEST_DIR}/actual_maildir
293
294 mkdir ${MAIL_DIR}
295 ln -s ${TEST_DIR}/actual_maildir ${MAIL_DIR}/symlink
296
297 execute_expecting new "Added 1 new message to the database."
298
299 printf " New symlink to a file...\t"
300 generate_message
301 external_msg_filename=${TEST_DIR}/external/$(basename $gen_msg_filename)
302 mkdir -p $(dirname $external_msg_filename)
303 mv $gen_msg_filename $external_msg_filename
304 ln -s $external_msg_filename $gen_msg_filename
305 increment_mtime ${MAIL_DIR}
306 execute_expecting new "Added 1 new message to the database."
307
308 printf " New two-level directory...\t"
309
310 generate_message [dir]=two/levels
311 generate_message [dir]=two/levels
312 generate_message [dir]=two/levels
313
314 execute_expecting new "Added 3 new messages to the database."
315
316 printf " Deleted two-level directory... "
317
318 rm -rf ${MAIL_DIR}/two
319 increment_mtime ${MAIL_DIR}
320
321 execute_expecting new "No new mail. Removed 3 messages."
322
323 printf "\nTesting \"notmuch search\" in several variations:\n"
324
325 printf " Search body...\t\t\t"
326 add_message '[subject]="body search"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [body]=bodysearchtest
327 execute_expecting "search bodysearchtest" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (inbox unread)"
328
329 printf " Search by from:...\t\t"
330 add_message '[subject]="search by from"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [from]=searchbyfrom
331 execute_expecting "search from:searchbyfrom" "thread:XXX   2000-01-01 [1/1] searchbyfrom; search by from (inbox unread)"
332
333 printf " Search by to:...\t\t"
334 add_message '[subject]="search by to"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [to]=searchbyto
335 execute_expecting "search to:searchbyto" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (inbox unread)"
336
337 printf " Search by subject:...\t\t"
338 add_message [subject]=subjectsearchtest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
339 execute_expecting "search subject:subjectsearchtest" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subjectsearchtest (inbox unread)"
340
341 printf " Search by id:...\t\t"
342 add_message '[subject]="search by id"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
343 execute_expecting "search id:${gen_msg_id}" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by id (inbox unread)"
344
345 printf " Search by tag:...\t\t"
346 add_message '[subject]="search by tag"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
347 $NOTMUCH tag +searchbytag id:${gen_msg_id}
348 execute_expecting "search tag:searchbytag" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by tag (inbox searchbytag unread)"
349
350 printf " Search by thread:...\t\t"
351 add_message '[subject]="search by thread"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
352 thread_id=$($NOTMUCH search id:${gen_msg_id} | sed -e 's/thread:\([a-f0-9]*\).*/\1/')
353 execute_expecting "search thread:${thread_id}" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by thread (inbox unread)"
354
355 printf " Search body (phrase)...\t"
356 add_message '[subject]="body search (phrase)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="body search (phrase)"'
357 add_message '[subject]="negative result"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[body]="This phrase should not match the body search"'
358 execute_expecting "search '\"body search (phrase)\"'" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; body search (phrase) (inbox unread)"
359
360 printf " Search by from: (address)...\t"
361 add_message '[subject]="search by from (address)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [from]=searchbyfrom@example.com
362 execute_expecting "search from:searchbyfrom@example.com" "thread:XXX   2000-01-01 [1/1] searchbyfrom@example.com; search by from (address) (inbox unread)"
363
364 printf " Search by from: (name)...\t"
365 add_message '[subject]="search by from (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[from]="Search By From Name <test@example.com>"'
366 execute_expecting "search from:'Search By From Name'" "thread:XXX   2000-01-01 [1/1] Search By From Name; search by from (name) (inbox unread)"
367
368 printf " Search by to: (address)...\t"
369 add_message '[subject]="search by to (address)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' [to]=searchbyto@example.com
370 execute_expecting "search to:searchbyto@example.com" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (address) (inbox unread)"
371
372 printf " Search by to: (name)...\t"
373 add_message '[subject]="search by to (name)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' '[to]="Search By To Name <test@example.com>"'
374 execute_expecting "search to:'Search By To Name'" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; search by to (name) (inbox unread)"
375
376 printf " Search by subject: (phrase)...\t"
377 add_message '[subject]="subject search test (phrase)"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
378 add_message '[subject]="this phrase should not match the subject search test"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
379 execute_expecting "search 'subject:\"subject search test (phrase)\"'" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; subject search test (phrase) (inbox unread)"
380
381 printf "\nTesting \"notmuch reply\" in several variations:\n"
382
383 printf " Basic reply...\t\t\t"
384 add_message '[from]="Sender <sender@example.com>"' \
385              [to]=test_suite@notmuchmail.org \
386              [subject]=notmuch-reply-test \
387             '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
388             '[body]="basic reply test"'
389
390 execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
391 Subject: Re: notmuch-reply-test
392 To: Sender <sender@example.com>
393 Bcc: test_suite@notmuchmail.org
394 In-Reply-To: <${gen_msg_id}>
395 References: <${gen_msg_id}>
396
397 On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
398 > basic reply test"
399
400 printf " Multiple recipients...\t\t"
401 add_message '[from]="Sender <sender@example.com>"' \
402             '[to]="test_suite@notmuchmail.org, Someone Else <someone@example.com>"' \
403              [subject]=notmuch-reply-test \
404             '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
405             '[body]="Multiple recipients"'
406
407 execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
408 Subject: Re: notmuch-reply-test
409 To: Sender <sender@example.com>, Someone Else <someone@example.com>
410 Bcc: test_suite@notmuchmail.org
411 In-Reply-To: <${gen_msg_id}>
412 References: <${gen_msg_id}>
413
414 On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
415 > Multiple recipients"
416
417 printf " Reply with CC...\t\t"
418 add_message '[from]="Sender <sender@example.com>"' \
419              [to]=test_suite@notmuchmail.org \
420             '[cc]="Other Parties <cc@example.com>"' \
421              [subject]=notmuch-reply-test \
422             '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
423             '[body]="reply with CC"'
424
425 execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
426 Subject: Re: notmuch-reply-test
427 To: Sender <sender@example.com>
428 Cc: Other Parties <cc@example.com>
429 Bcc: test_suite@notmuchmail.org
430 In-Reply-To: <${gen_msg_id}>
431 References: <${gen_msg_id}>
432
433 On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
434 > reply with CC"
435
436 printf " Reply from alternate address..."
437 add_message '[from]="Sender <sender@example.com>"' \
438              [to]=test_suite_other@notmuchmail.org \
439              [subject]=notmuch-reply-test \
440             '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
441             '[body]="reply from alternate address"'
442
443 execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
444 Subject: Re: notmuch-reply-test
445 To: Sender <sender@example.com>
446 Bcc: test_suite@notmuchmail.org
447 In-Reply-To: <${gen_msg_id}>
448 References: <${gen_msg_id}>
449
450 On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
451 > reply from alternate address"
452
453 printf " Support for Reply-To...\t"
454 add_message '[from]="Sender <sender@example.com>"' \
455              [to]=test_suite@notmuchmail.org \
456              [subject]=notmuch-reply-test \
457             '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
458             '[body]="support for reply-to"' \
459             '[reply-to]="Sender <elsewhere@example.com>"'
460
461 execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
462 Subject: Re: notmuch-reply-test
463 To: Sender <elsewhere@example.com>
464 Bcc: test_suite@notmuchmail.org
465 In-Reply-To: <${gen_msg_id}>
466 References: <${gen_msg_id}>
467
468 On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
469 > support for reply-to"
470
471 printf " Un-munging Reply-To...\t\t"
472 add_message '[from]="Sender <sender@example.com>"' \
473             '[to]="Some List <list@example.com>"' \
474              [subject]=notmuch-reply-test \
475             '[date]="Tue, 05 Jan 2010 15:43:56 -0800"' \
476             '[body]="Un-munging Reply-To"' \
477             '[reply-to]="Evil Munging List <list@example.com>"'
478
479 execute_expecting "reply id:${gen_msg_id}" "From: Notmuch Test Suite <test_suite@notmuchmail.org>
480 Subject: Re: notmuch-reply-test
481 To: Sender <sender@example.com>, Some List <list@example.com>
482 Bcc: test_suite@notmuchmail.org
483 In-Reply-To: <${gen_msg_id}>
484 References: <${gen_msg_id}>
485
486 On Tue, 05 Jan 2010 15:43:56 -0800, Sender <sender@example.com> wrote:
487 > Un-munging Reply-To"
488
489 printf "\nTesting handling of uuencoded data:\n"
490
491 add_message [subject]=uuencodetest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
492 '[body]="This message is used to ensure that notmuch correctly handles a
493 message containing a block of uuencoded data. First, we have a marker
494 this content beforeuudata . Then we beging the uunencoded data itself:
495
496 begin 644 bogus-uuencoded-data
497 M0123456789012345678901234567890123456789012345678901234567890
498 MOBVIOUSLY, THIS IS NOT ANY SORT OF USEFUL UUNECODED DATA.    
499 MINSTEAD THIS IS JUST A WAY TO ENSURE THAT THIS BLOCK OF DATA 
500 MIS CORRECTLY IGNORED WHEN NOTMUCH CREATES ITS INDEX. SO WE   
501 MINCLUDE A DURINGUUDATA MARKER THAT SHOULD NOT RESULT IN ANY  
502 MSEARCH RESULT.                                               
503 \`
504 end
505
506 Finally, we have our afteruudata marker as well."'
507
508 printf " Ensure content before uu data is indexed..."
509 execute_expecting "search beforeuudata" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
510 printf " Ensure uu data is not indexed...\t"
511 execute_expecting "search DURINGUUDATA" ""
512 printf " Ensure content after uu data is indexed..."
513 execute_expecting "search afteruudata" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; uuencodetest (inbox unread)"
514
515 printf "\nTesting \"notmuch dump\" and \"notmuch restore\":\n"
516
517 printf " Dumping all tags...\t\t"
518 $NOTMUCH dump dump.expected
519 echo "  PASS"
520
521 printf " Clearing all tags...\t\t"
522 sed -e 's/(\([^(]*\))$/()/' < dump.expected > clear.expected
523 $NOTMUCH restore clear.expected
524 $NOTMUCH dump clear.actual
525 if diff clear.expected clear.actual > /dev/null; then
526     echo "      PASS"
527 else
528     echo "      FAIL"
529     echo "      Expected output: See file clear.expected"
530     echo "      Actual output:   See file clear.actual"
531 fi
532
533 printf " Restoring original tags...\t"
534 $NOTMUCH restore dump.expected
535 $NOTMUCH dump dump.actual
536 if diff dump.expected dump.actual > /dev/null; then
537     echo "      PASS"
538 else
539     echo "      FAIL"
540     echo "      Expected output: See file dump.expected"
541     echo "      Actual output:   See file dump.actual"
542 fi
543
544 printf " Restore with nothing to do...\t"
545 $NOTMUCH restore dump.expected
546 echo "  PASS"
547
548 printf "\nTesting threading when messages received out of order:\n"
549 printf " Adding initial child message...\t\t"
550 generate_message [body]=foo '[in-reply-to]=\<parent-id\>' [subject]=brokenthreadtest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
551 execute_expecting new "Added 1 new message to the database."
552 printf " Searching returns the message...\t\t"
553 execute_expecting "search foo" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; brokenthreadtest (inbox unread)"
554 printf " Adding second child message...\t\t\t"
555 generate_message [body]=foo '[in-reply-to]=\<parent-id\>' [subject]=brokenthreadtest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
556 execute_expecting new "Added 1 new message to the database."
557 printf " Searching returns both messages in one thread..."
558 execute_expecting "search foo" "thread:XXX   2000-01-01 [2/2] Notmuch Test Suite; brokenthreadtest (inbox unread)"
559 printf " Adding parent message...\t\t\t"
560 generate_message [body]=foo [id]=parent-id [subject]=brokenthreadtest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
561 execute_expecting new "Added 1 new message to the database."
562 printf " Searching returns all three messages in one thread..."
563 execute_expecting "search foo" "thread:XXX   2000-01-01 [3/3] Notmuch Test Suite; brokenthreadtest (inbox unread)"
564
565 cat <<EOF
566 Notmuch test suite complete.
567
568 Intermediate state can be examined in:
569         ${TEST_DIR}
570 EOF