3 test_description="emacs interface"
4 . $(dirname "$0")/test-lib.sh || exit 1
6 EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
10 # syntax errors in test-lib.el cause mysterious failures
11 test_begin_subtest "Syntax of emacs test library"
12 test_expect_success "${TEST_EMACS} -Q --batch --load $NOTMUCH_SRCDIR/test/test-lib.el"
14 test_begin_subtest "Basic notmuch-hello view in emacs"
15 test_emacs '(notmuch-hello)
17 test_expect_equal_file $EXPECTED/notmuch-hello OUTPUT
19 test_begin_subtest "Saved search with 0 results"
20 test_emacs '(let ((notmuch-show-empty-saved-searches t)
21 (notmuch-saved-searches
22 '\''(("inbox" . "tag:inbox")
23 ("unread" . "tag:unread")
24 ("empty" . "tag:doesnotexist"))))
27 test_expect_equal_file $EXPECTED/notmuch-hello-with-empty OUTPUT
29 test_begin_subtest "No saved searches displayed (all with 0 results)"
30 test_emacs '(let ((notmuch-saved-searches
31 '\''(("empty" . "tag:doesnotexist"))))
34 test_expect_equal_file $EXPECTED/notmuch-hello-no-saved-searches OUTPUT
36 test_begin_subtest "Basic notmuch-search view in emacs"
37 test_emacs '(notmuch-search "tag:inbox")
40 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox OUTPUT
42 test_begin_subtest "Incremental parsing of search results"
43 test_emacs "(cl-letf* (((symbol-function 'orig)
44 (symbol-function 'notmuch-search-process-filter))
45 ((symbol-function 'notmuch-search-process-filter)
47 (cl-loop for char across string
48 do (orig proc (char-to-string char))))))
49 (notmuch-search \"tag:inbox\")
52 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox OUTPUT
54 test_begin_subtest "Navigation of notmuch-hello to search results"
55 test_emacs '(notmuch-hello)
56 (goto-char (point-min))
57 (re-search-forward "inbox")
58 (widget-button-press (1- (point)))
61 test_expect_equal_file $EXPECTED/notmuch-hello-view-inbox OUTPUT
63 test_begin_subtest "Basic notmuch-show view in emacs"
64 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
65 test_emacs "(notmuch-show \"$maildir_storage_thread\")
67 test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage OUTPUT
69 test_begin_subtest "Basic notmuch-show view in emacs default indentation"
70 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
71 test_emacs "(let ((notmuch-show-indent-messages-width 1))
72 (notmuch-show \"$maildir_storage_thread\")
74 test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage OUTPUT
76 test_begin_subtest "Basic notmuch-show view in emacs without indentation"
77 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
78 test_emacs "(let ((notmuch-show-indent-messages-width 0))
79 (notmuch-show \"$maildir_storage_thread\")
81 test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage-without-indentation OUTPUT
83 test_begin_subtest "Basic notmuch-show view in emacs with fourfold indentation"
84 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
85 test_emacs "(let ((notmuch-show-indent-messages-width 4))
86 (notmuch-show \"$maildir_storage_thread\")
88 test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation OUTPUT
90 test_begin_subtest "notmuch-show for message with invalid From"
91 add_message "[subject]=\"message-with-invalid-from\"" \
92 "[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
93 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
94 test_emacs "(notmuch-show \"$thread\")
95 (test-output \"OUTPUT.raw\")"
97 Invalid " From <test_suite@notmuchmail.org> (2001-01-05) (inbox)
98 Subject: message-with-invalid-from
99 To: Notmuch Test Suite <test_suite@notmuchmail.org>
102 This is just a test message (#1)
104 notmuch_date_sanitize < OUTPUT.raw > OUTPUT
105 test_expect_equal_file EXPECTED OUTPUT
107 test_begin_subtest "Navigation of notmuch-search to thread view"
108 test_emacs '(notmuch-search "tag:inbox")
110 (goto-char (point-min))
111 (re-search-forward "Working with Maildir")
112 (notmuch-search-show-thread)
115 test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage OUTPUT
117 test_begin_subtest "Add tag from search view"
118 os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com)
119 test_emacs "(notmuch-search \"$os_x_darwin_thread\")
121 (execute-kbd-macro \"+tag-from-search-view\")"
122 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
123 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-search-view unread)"
125 test_begin_subtest "Remove tag from search view"
126 test_emacs "(notmuch-search \"$os_x_darwin_thread\")
128 (execute-kbd-macro \"-tag-from-search-view\")"
129 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
130 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
132 test_begin_subtest "Add tag (large query)"
133 # We use a long query to force us into batch mode and use a funny tag
134 # that requires escaping for batch tagging.
135 test_emacs "(notmuch-tag (concat \"$os_x_darwin_thread\" \" or \" (mapconcat #'identity (make-list notmuch-tag-argument-limit \"x\") \"-\")) (list \"+tag-from-%-large-query\"))"
136 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
137 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-%-large-query unread)"
138 notmuch tag -tag-from-%-large-query $os_x_darwin_thread
140 test_begin_subtest "notmuch-show: add single tag to single message"
141 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
142 (execute-kbd-macro \"+tag-from-show-view\")"
143 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
144 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag-from-show-view unread)"
146 test_begin_subtest "notmuch-show: remove single tag from single message"
147 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
148 (execute-kbd-macro \"-tag-from-show-view\")"
149 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
150 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
152 test_begin_subtest "notmuch-show: add multiple tags to single message"
153 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
154 (execute-kbd-macro \"+tag1-from-show-view +tag2-from-show-view\")"
155 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
156 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox tag1-from-show-view tag2-from-show-view unread)"
158 test_begin_subtest "notmuch-show: remove multiple tags from single message"
159 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
160 (execute-kbd-macro \"-tag1-from-show-view -tag2-from-show-view\")"
161 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
162 test_expect_equal "$output" "thread:XXX 2009-11-18 [4/4] Jjgod Jiang, Alexander Botero-Lowry; [notmuch] Mac OS X/Darwin compatibility issues (inbox unread)"
164 test_begin_subtest "Message with .. in Message-Id:"
165 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
166 test_emacs '(notmuch-search "id:\"123..456@example\"")
168 (execute-kbd-macro "+search-add")
169 (execute-kbd-macro "+search-remove")
170 (execute-kbd-macro "-search-remove")
171 (notmuch-show "id:\"123..456@example\"")
173 (execute-kbd-macro "+show-add")
174 (execute-kbd-macro "+show-remove")
175 (execute-kbd-macro "-show-remove")'
176 output=$(notmuch search 'id:"123..456@example"' | notmuch_search_sanitize)
177 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Message with .. in Message-Id (inbox search-add show-add)"
179 test_begin_subtest "Message with quote in Message-Id:"
180 add_message '[id]="\"quote\"@example"' '[subject]="Message with quote in Message-Id"'
181 test_emacs '(notmuch-search "subject:\"Message with quote\"")
183 (execute-kbd-macro "+search-add")
184 (notmuch-search-show-thread)
186 (execute-kbd-macro "+show-add")'
187 output=$(notmuch search 'id:"""quote""@example"' | notmuch_search_sanitize)
188 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Message with quote in Message-Id (inbox search-add show-add)"
190 test_begin_subtest "Sending a message via (fake) SMTP"
191 emacs_deliver_message \
192 'Testing message sent via SMTP' \
193 'This is a test that messages are sent via SMTP' \
196 (insert "To: user@example.com\n")'
198 -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' \
199 -e s',^\(Content-Type: text/plain\); charset=us-ascii$,\1,' < sent_message >OUTPUT
201 From: Notmuch Test Suite <test_suite@notmuchmail.org>
203 Subject: Testing message sent via SMTP
204 Date: 01 Jan 2000 12:00:00 -0000
207 Content-Type: text/plain
209 This is a test that messages are sent via SMTP
211 test_expect_equal_file EXPECTED OUTPUT
213 test_begin_subtest "Folding a long header when sending via (fake) SMTP"
214 long_subject="This is a long subject `echo {1..1000}`"
215 emacs_deliver_message \
217 'This is a test that long headers are folded when messages are sent via SMTP' \
220 (insert "To: user@example.com\n")'
222 -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' \
223 -e s',^\(Content-Type: text/plain\); charset=us-ascii$,\1,' < sent_message >OUTPUT
225 From: Notmuch Test Suite <test_suite@notmuchmail.org>
227 Subject: This is a long subject 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
228 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
229 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
230 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
231 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
232 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
233 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
234 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
235 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
236 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
237 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
238 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
240 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
241 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
242 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
243 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
244 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
245 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365
246 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
247 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
248 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
249 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
250 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
251 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473
252 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491
253 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509
254 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527
255 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545
256 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563
257 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581
258 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
259 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
260 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
261 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653
262 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671
263 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689
264 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707
265 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725
266 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743
267 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761
268 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779
269 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797
270 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815
271 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833
272 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851
273 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869
274 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887
275 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905
276 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923
277 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941
278 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959
279 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977
280 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995
282 Date: 01 Jan 2000 12:00:00 -0000
285 Content-Type: text/plain
287 This is a test that long headers are folded when messages are sent via SMTP
289 test_expect_equal_file EXPECTED OUTPUT
291 test_begin_subtest "Verify that sent messages are saved/searchable (via FCC)"
292 notmuch new > /dev/null
293 output=$(notmuch search 'subject:"testing message sent via SMTP"' | notmuch_search_sanitize)
294 test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
296 test_begin_subtest "notmuch-fcc-dirs set to nil"
297 test_emacs "(let ((notmuch-fcc-dirs nil))
301 From: Notmuch Test Suite <test_suite@notmuchmail.org>
304 --text follows this line--
306 test_expect_equal_file EXPECTED OUTPUT
308 # Make another FCC maildir specific for the next test
309 mkdir -p mail/sent-string/cur
310 mkdir -p mail/sent-string/new
311 mkdir -p mail/sent-string/tmp
313 test_begin_subtest "notmuch-fcc-dirs set to a string"
314 test_emacs "(let ((notmuch-fcc-dirs \"sent-string\"))
318 From: Notmuch Test Suite <test_suite@notmuchmail.org>
321 Fcc: ${MAIL_DIR}/sent-string
322 --text follows this line--
324 test_expect_equal_file EXPECTED OUTPUT
326 # Make more FCC maildirs specific for the next test
327 mkdir -p mail/sent-list-match/cur
328 mkdir -p mail/sent-list-match/new
329 mkdir -p mail/sent-list-match/tmp
330 mkdir -p mail/failure/cur
331 mkdir -p mail/failure/new
332 mkdir -p mail/failure/tmp
334 test_begin_subtest "notmuch-fcc-dirs set to a list (with match)"
335 test_emacs "(let ((notmuch-fcc-dirs
336 '((\"notmuchmail.org\" . \"sent-list-match\")
337 (\".*\" . \"failure\"))))
341 From: Notmuch Test Suite <test_suite@notmuchmail.org>
344 Fcc: ${MAIL_DIR}/sent-list-match
345 --text follows this line--
347 test_expect_equal_file EXPECTED OUTPUT
349 # Make another FCC maildir specific for the next test
350 mkdir -p mail/sent-list-catch-all/cur
351 mkdir -p mail/sent-list-catch-all/new
352 mkdir -p mail/sent-list-catch-all/tmp
354 test_begin_subtest "notmuch-fcc-dirs set to a list (catch-all)"
355 test_emacs "(let ((notmuch-fcc-dirs
356 '((\"example.com\" . \"failure\")
357 (\".*\" . \"sent-list-catch-all\"))))
361 From: Notmuch Test Suite <test_suite@notmuchmail.org>
364 Fcc: ${MAIL_DIR}/sent-list-catch-all
365 --text follows this line--
367 test_expect_equal_file EXPECTED OUTPUT
369 test_begin_subtest "notmuch-fcc-dirs set to a list (no match)"
370 test_emacs "(let ((notmuch-fcc-dirs
371 '((\"example.com\" . \"failure\")
372 (\"nomatchhere.net\" . \"failure\"))))
376 From: Notmuch Test Suite <test_suite@notmuchmail.org>
379 --text follows this line--
381 test_expect_equal_file EXPECTED OUTPUT
383 test_begin_subtest "Reply within emacs"
384 test_emacs '(let ((message-hidden-headers ''()))
385 (notmuch-search "subject:\"testing message sent via SMTP\"")
387 (notmuch-search-reply-to-thread)
389 sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
390 sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT
392 From: Notmuch Test Suite <test_suite@notmuchmail.org>
394 Subject: Re: Testing message sent via SMTP
396 Fcc: ${MAIL_DIR}/sent
398 --text follows this line--
399 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
401 > This is a test that messages are sent via SMTP
403 test_expect_equal_file EXPECTED OUTPUT
405 test_begin_subtest "Reply within emacs to a message with TAB in subject"
406 test_emacs '(let ((message-hidden-headers ''()))
407 (notmuch-search "id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net")
409 (notmuch-search-show-thread)
411 (notmuch-show-reply-sender)
413 sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
414 sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT
415 sed -i -e '/^--text follows this line--$/q' OUTPUT
417 From: Notmuch Test Suite <test_suite@notmuchmail.org>
418 To: Mikhail Gusarov <dottedmag@dottedmag.net>
419 Subject: Re: [notmuch] [PATCH 1/2] Close message file after parsing message headers
421 Fcc: ${MAIL_DIR}/sent
423 --text follows this line--
425 test_expect_equal_file EXPECTED OUTPUT
427 test_begin_subtest "Reply from alternate address within emacs"
428 add_message '[from]="Sender <sender@example.com>"' \
429 [to]=test_suite_other@notmuchmail.org
431 test_emacs "(let ((message-hidden-headers '()))
432 (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
434 (notmuch-search-reply-to-thread)
437 From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
438 To: Sender <sender@example.com>
439 Subject: Re: ${test_subtest_name}
440 In-Reply-To: <${gen_msg_id}>
441 Fcc: ${MAIL_DIR}/sent
442 References: <${gen_msg_id}>
443 --text follows this line--
444 Sender <sender@example.com> writes:
446 > This is just a test message (#${gen_msg_cnt})
448 test_expect_equal_file EXPECTED OUTPUT
450 test_begin_subtest "Reply from address in named group list within emacs"
451 add_message '[from]="Sender <sender@example.com>"' \
452 '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
453 [cc]=test_suite_other@notmuchmail.org
455 test_emacs "(let ((message-hidden-headers '()))
456 (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
458 (notmuch-search-reply-to-thread)
461 From: Notmuch Test Suite <test_suite@notmuchmail.org>
462 To: Sender <sender@example.com>, someone@example.com
463 Subject: Re: ${test_subtest_name}
464 In-Reply-To: <${gen_msg_id}>
465 Fcc: ${MAIL_DIR}/sent
466 References: <${gen_msg_id}>
467 --text follows this line--
468 Sender <sender@example.com> writes:
470 > This is just a test message (#${gen_msg_cnt})
472 test_expect_equal_file EXPECTED OUTPUT
474 test_begin_subtest "Reply within emacs to a multipart/mixed message"
475 test_emacs '(let ((message-hidden-headers ''()))
476 (notmuch-show "id:20091118002059.067214ed@hikari")
480 From: Notmuch Test Suite <test_suite@notmuchmail.org>
481 To: Adrian Perez de Castro <aperez@igalia.com>, notmuch@notmuchmail.org
482 Subject: Re: [notmuch] Introducing myself
483 In-Reply-To: <20091118002059.067214ed@hikari>
484 Fcc: ${MAIL_DIR}/sent
485 References: <20091118002059.067214ed@hikari>
486 --text follows this line--
487 Adrian Perez de Castro <aperez@igalia.com> writes:
491 > I have just heard about Not Much today in some random Linux-related news
492 > site (LWN?), my name is Adrian Perez and I work as systems administrator
493 > (although I can do some code as well :P). I have always thought that the
494 > ideas behind Sup were great, but after some time using it, I got tired of
495 > the oddities that it has. I also do not like doing things like having to
496 > install Ruby just for reading and sorting mails. Some time ago I thought
497 > about doing something like Not Much and in fact I played a bit with the
498 > Python+Xapian and the Python+Whoosh combinations, because I find relaxing
499 > to code things in Python when I am not working and also it is installed
500 > by default on most distribution. I got to have some mailboxes indexed and
501 > basic searching working a couple of months ago. Lately I have been very
502 > busy and had no time for coding, and them... boom! Not Much appears -- and
503 > it is almost exactly what I was trying to do, but faster. I have been
504 > playing a bit with Not Much today, and I think it has potential.
506 > Also, I would like to share one idea I had in mind, that you might find
507 > interesting: One thing I have found very annoying is having to re-tag my
508 > mail when the indexes get b0rked (it happened a couple of times to me while
509 > using Sup), so I was planning to mails as read/unread and adding the tags
510 > not just to the index, but to the mail text itself, e.g. by adding a
511 > "X-Tags" header field or by reusing the "Keywords" one. This way, the index
512 > could be totally recreated by re-reading the mail directories, and this
513 > would also allow to a tools like OfflineIMAP [1] to get the mails into a
514 > local maildir, tagging and indexing the mails with the e-mail reader and
515 > then syncing back the messages with the "X-Tags" header to the IMAP server.
516 > This would allow to use the mail reader from a different computer and still
517 > have everything tagged finely.
523 > [1] http://software.complete.org/software/projects/show/offlineimap
526 > Adrian Perez de Castro <aperez@igalia.com>
527 > Igalia - Free Software Engineering
528 > _______________________________________________
529 > notmuch mailing list
530 > notmuch@notmuchmail.org
531 > http://notmuchmail.org/mailman/listinfo/notmuch
533 test_expect_equal_file EXPECTED OUTPUT
535 test_begin_subtest "Reply within emacs to a multipart/alternative message"
536 test_emacs '(let ((message-hidden-headers ''()))
537 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
541 From: Notmuch Test Suite <test_suite@notmuchmail.org>
542 To: Alex Botero-Lowry <alex.boterolowry@gmail.com>, notmuch@notmuchmail.org
543 Subject: Re: [notmuch] preliminary FreeBSD support
544 In-Reply-To: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
545 Fcc: ${MAIL_DIR}/sent
546 References: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
547 --text follows this line--
548 Alex Botero-Lowry <alex.boterolowry@gmail.com> writes:
550 > I saw the announcement this morning, and was very excited, as I had been
551 > hoping sup would be turned into a library,
552 > since I like the concept more than the UI (I'd rather an emacs interface).
554 > I did a preliminary compile which worked out fine, but
555 > sysconf(_SC_SC_GETPW_R_SIZE_MAX) returns -1 on
556 > FreeBSD, so notmuch_config_open segfaulted.
558 > Attached is a patch that supplies a default buffer size of 64 in cases where
561 > http://www.opengroup.org/austin/docs/austin_328.txt - seems to indicate this
562 > is acceptable behavior,
563 > and http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/07/msg016808.htmlspecifically
566 > From e3bc4bbd7b9d0d086816ab5f8f2d6ffea1dd3ea4 Mon Sep 17 00:00:00 2001
567 > From: Alexander Botero-Lowry <alex.boterolowry@gmail.com>
568 > Date: Tue, 17 Nov 2009 11:30:39 -0800
569 > Subject: [PATCH] Deal with situation where sysconf(_SC_GETPW_R_SIZE_MAX) returns -1
572 > notmuch-config.c | 2 ++
573 > 1 files changed, 2 insertions(+), 0 deletions(-)
575 > diff --git a/notmuch-config.c b/notmuch-config.c
576 > index 248149c..e7220d8 100644
577 > --- a/notmuch-config.c
578 > +++ b/notmuch-config.c
579 > @@ -77,6 +77,7 @@ static char *
580 > get_name_from_passwd_file (void *ctx)
582 > long pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
583 > + if (pw_buf_size == -1) pw_buf_size = 64;
584 > char *pw_buf = talloc_zero_size (ctx, pw_buf_size);
585 > struct passwd passwd, *ignored;
587 > @@ -101,6 +102,7 @@ static char *
588 > get_username_from_passwd_file (void *ctx)
590 > long pw_buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
591 > + if (pw_buf_size == -1) pw_buf_size = 64;
592 > char *pw_buf = talloc_zero_size (ctx, pw_buf_size);
593 > struct passwd passwd, *ignored;
598 > _______________________________________________
599 > notmuch mailing list
600 > notmuch@notmuchmail.org
601 > http://notmuchmail.org/mailman/listinfo/notmuch
603 test_expect_equal_file EXPECTED OUTPUT
605 test_begin_subtest "Reply within emacs to an html-only message"
606 add_message '[content-type]="text/html"' \
607 '[body]="Hi,<br />This is an <b>HTML</b> test message.<br /><br />OK?"'
608 test_emacs "(let ((message-hidden-headers '()))
609 (notmuch-show \"id:${gen_msg_id}\")
613 From: Notmuch Test Suite <test_suite@notmuchmail.org>
614 To: test_suite@notmuchmail.org
615 Subject: Re: Reply within emacs to an html-only message
616 In-Reply-To: <${gen_msg_id}>
617 Fcc: ${MAIL_DIR}/sent
618 References: <${gen_msg_id}>
619 --text follows this line--
620 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
622 > Hi,This is an HTML test message.OK?
624 test_expect_equal_file EXPECTED OUTPUT
626 test_begin_subtest "Reply within emacs to message from self"
627 add_message '[from]="test_suite@notmuchmail.org"' \
628 '[to]="test_suite@notmuchmail.org"'
629 test_emacs "(let ((message-hidden-headers '()))
630 (notmuch-show \"id:${gen_msg_id}\")
633 sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
634 sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT
636 From: Notmuch Test Suite <test_suite@notmuchmail.org>
637 To: test_suite@notmuchmail.org
638 Subject: Re: Reply within emacs to message from self
640 Fcc: ${MAIL_DIR}/sent
642 --text follows this line--
643 test_suite@notmuchmail.org writes:
645 > This is just a test message (#7)
647 test_expect_equal_file EXPECTED OUTPUT
649 test_begin_subtest "Quote MML tags in reply"
650 message_id='test-emacs-mml-quoting@message.id'
651 add_message [id]="$message_id" \
652 "[subject]='$test_subtest_name'" \
653 '[body]="<#part disposition=inline>"'
654 test_emacs "(let ((message-hidden-headers '()))
655 (notmuch-show \"id:$message_id\")
659 From: Notmuch Test Suite <test_suite@notmuchmail.org>
660 To: test_suite@notmuchmail.org
661 Subject: Re: Quote MML tags in reply
662 In-Reply-To: <test-emacs-mml-quoting@message.id>
663 Fcc: ${MAIL_DIR}/sent
664 References: <test-emacs-mml-quoting@message.id>
665 --text follows this line--
666 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
668 > <#!part disposition=inline>
670 test_expect_equal_file EXPECTED OUTPUT
672 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments"
673 # save as archive to test that Emacs does not re-compress .gz
674 test_emacs '(let ((standard-input "\"attachment1.gz\""))
675 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
676 (notmuch-show-save-attachments))'
677 test_expect_equal_file attachment1.gz "$EXPECTED/attachment"
679 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part"
680 # save as archive to test that Emacs does not re-compress .gz
681 test_emacs '(let ((standard-input "\"attachment2.gz\""))
682 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
683 (search-forward "0001-Deal-with")
684 (notmuch-show-save-part))'
685 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"
687 test_begin_subtest "Save 8bit attachment from within emacs using notmuch-show-save-attachments"
689 add_message '[subject]="Attachment with 8bit chars"' \
690 '[header]="MIME-Version: 1.0"' \
691 '[content-type]="multipart/mixed; boundary=\"abcd\""' \
693 Content-Type: text/plain
698 Content-Type: application/octet-stream; name=\"sample\"
699 Content-Transfer-Encoding: 8bit
700 Content-Disposition: attachment; filename=\"sample\"
702 “¡ Hey ! It compiles ¡ Ship it !”
706 test_emacs '(notmuch-show "id:'"${gen_msg_id}"'")
707 (delete-file "OUTPUT")
708 (let ((standard-input "\"OUTPUT\""))
709 (notmuch-show-save-attachments))'
711 test_expect_equal "$(cat OUTPUT)" '“¡ Hey ! It compiles ¡ Ship it !”'
713 test_begin_subtest "View raw message within emacs"
714 test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
715 (notmuch-show-view-raw-message)
717 test_expect_equal_file $EXPECTED/raw-message-cf0c4d-52ad0a OUTPUT
719 test_begin_subtest "Hiding/showing signature in notmuch-show view"
720 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
721 test_emacs "(notmuch-show \"$maildir_storage_thread\")
722 (search-forward \"Click/Enter to show.\")
723 (button-activate (button-at (point)))
724 (search-backward \"Click/Enter to hide.\")
725 (button-activate (button-at (point)))
727 test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage OUTPUT
729 test_begin_subtest "Detection and hiding of top-post quoting of message"
730 add_message '[subject]="The problem with top-posting"' \
731 [id]=top-post-target \
732 '[body]="A: Because it messes up the order in which people normally read text.
733 Q: Why is top-posting such a bad thing?
735 Q: What is the most annoying thing in e-mail?"'
736 add_message '[from]="Top Poster <top@poster.com>"' \
737 [in-reply-to]=top-post-target \
738 [references]=top-post-target \
739 '[subject]="Re: The problem with top-posting"' \
740 '[body]="Thanks for the advice! I will be sure to put it to good use.
744 ----- Original Message -----
745 From: Notmuch Test Suite <test_suite@notmuchmail.org>
746 To: Notmuch Test Suite <test_suite@notmuchmai.org>
747 Sent: Fri, 05 Jan 2001 15:43:57 +0000
748 Subject: The problem with top-posting
750 Q: Why is top-posting such a bad thing?
752 Q: What is the most annoying thing in e-mail?"'
753 test_emacs "(notmuch-show \"top-posting\")
754 (test-visible-output \"OUTPUT.raw\")"
755 echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
756 Subject: The problem with top-posting
757 To: Notmuch Test Suite <test_suite@notmuchmail.org>
760 A: Because it messes up the order in which people normally read text.
761 Q: Why is top-posting such a bad thing?
763 Q: What is the most annoying thing in e-mail?
764 Top Poster <top@poster.com> (2001-01-05) (inbox unread)
765 Subject: Re: The problem with top-posting
766 To: Notmuch Test Suite <test_suite@notmuchmail.org>
769 Thanks for the advice! I will be sure to put it to good use.
773 [ 9-line hidden original message. Click/Enter to show. ]" > EXPECTED
774 notmuch_date_sanitize < OUTPUT.raw > OUTPUT
775 test_expect_equal_file EXPECTED OUTPUT
777 test_begin_subtest "Hiding message in notmuch-show view"
778 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
779 (notmuch-show-toggle-message)
780 (test-visible-output)'
781 test_expect_equal_file $EXPECTED/notmuch-show-thread-with-hidden-messages OUTPUT
783 test_begin_subtest "Hiding message with visible citation in notmuch-show view"
784 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
785 (search-forward "Click/Enter to show.")
786 (button-activate (button-at (point)))
787 (notmuch-show-toggle-message)
788 (test-visible-output)'
789 test_expect_equal_file $EXPECTED/notmuch-show-thread-with-hidden-messages OUTPUT
791 test_begin_subtest "notmuch-show: show message headers"
793 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
794 (notmuch-message-headers-visible t))
795 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
796 (test-visible-output))'
797 test_expect_equal_file $EXPECTED/notmuch-show-message-with-headers-visible OUTPUT
799 test_begin_subtest "notmuch-show: hide message headers"
801 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
802 (notmuch-message-headers-visible nil))
803 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
804 (test-visible-output))'
805 test_expect_equal_file $EXPECTED/notmuch-show-message-with-headers-hidden OUTPUT
807 test_begin_subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-visibility-headers)"
809 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
810 (notmuch-message-headers-visible t))
811 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
812 (notmuch-show-toggle-visibility-headers)
813 (test-visible-output))'
814 test_expect_equal_file $EXPECTED/notmuch-show-message-with-headers-hidden OUTPUT
816 test_begin_subtest "notmuch-show: collapse all messages in thread"
817 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")
818 (let ((current-prefix-arg t))
819 (notmuch-show-open-or-close-all)
820 (test-visible-output))'
821 test_expect_equal_file $EXPECTED/notmuch-show-thread-with-all-messages-collapsed OUTPUT
823 test_begin_subtest "notmuch-show: uncollapse all messages in thread"
824 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")
825 (notmuch-show-open-or-close-all)
826 (test-visible-output)'
827 test_expect_equal_file $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed OUTPUT
829 test_begin_subtest "Stashing in notmuch-show"
830 add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
831 '[from]="Some One <someone@somewhere.org>"' \
832 '[to]="Some One Else <notsomeone@somewhere.org>"' \
833 '[cc]="Notmuch <notmuch@notmuchmail.org>"' \
834 '[subject]="Stash my stashables"' \
836 '[body]="Unable to stash body. Where did you get it in the first place?!?"'
837 notmuch tag +stashtest id:${gen_msg_id}
838 test_emacs '(notmuch-show "id:\"bought\"")
839 (notmuch-show-stash-date)
840 (notmuch-show-stash-from)
841 (notmuch-show-stash-to)
842 (notmuch-show-stash-cc)
843 (notmuch-show-stash-subject)
844 (notmuch-show-stash-message-id)
845 (notmuch-show-stash-message-id-stripped)
846 (notmuch-show-stash-tags)
847 (notmuch-show-stash-filename)
848 (notmuch-show-stash-mlarchive-link "Gmane")
849 (notmuch-show-stash-mlarchive-link "MARC")
850 (notmuch-show-stash-mlarchive-link "Mail Archive, The")
852 (generate-new-buffer "*test-stashing*"))
856 (rotate-yank-pointer 1))
857 (reverse-region (point-min) (point-max))
860 Sat, 01 Jan 2000 12:00:00 +0000
861 Some One <someone@somewhere.org>
862 Some One Else <notsomeone@somewhere.org>
863 Notmuch <notmuch@notmuchmail.org>
869 https://mid.gmane.org/bought
870 https://marc.info/?i=bought
871 https://mid.mail-archive.com/bought
873 test_expect_equal_file EXPECTED OUTPUT
875 test_begin_subtest "Stashing in notmuch-search"
876 test_emacs '(notmuch-search "id:\"bought\"")
878 (notmuch-search-stash-thread-id)
880 (generate-new-buffer "*test-stashing*"))
883 sed -i -e 's/^thread:.*$/thread:XXX/' OUTPUT
884 test_expect_equal "$(cat OUTPUT)" "thread:XXX"
886 test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
887 message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu'
888 message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net'
889 test_emacs "(notmuch-show \"$message2\")
890 (test-output \"EXPECTED\")"
891 test_emacs "(notmuch-search \"$message1 or $message2\")
893 (notmuch-search-show-thread)
894 (goto-char (point-max))
896 (notmuch-show-advance-and-archive)
898 test_expect_equal_file EXPECTED OUTPUT
900 test_begin_subtest "Refresh show buffer"
901 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
902 (test-visible-output "EXPECTED")
903 (notmuch-show-refresh-view)
904 (test-visible-output)'
905 test_expect_equal_file EXPECTED OUTPUT
907 test_begin_subtest "Refresh modified show buffer"
908 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
909 (notmuch-show-toggle-message)
910 (notmuch-show-next-message)
911 (notmuch-show-toggle-message)
912 (test-visible-output "EXPECTED")
913 (notmuch-show-refresh-view)
914 (test-visible-output)'
915 test_expect_equal_file EXPECTED OUTPUT
917 test_begin_subtest "Do not call notmuch for non-inlinable application/mpeg parts"
918 id='message-with-application/mpeg-attachment@notmuchmail.org'
920 'Message with application/mpeg attachment' \
923 (insert \"Message-ID: <$id>\n\")
925 (mml-insert-part \"application/mpeg\")
926 (insert \"a fake mp3 file\")"
927 notmuch_counter_reset
928 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
929 (notmuch-show \"id:$id\"))"
930 test_expect_equal $(notmuch_counter_value) 1
932 test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts"
933 id='message-with-audio/mpeg-attachment@notmuchmail.org'
935 'Message with audio/mpeg attachment' \
938 (insert \"Message-ID: <$id>\n\")
940 (mml-insert-part \"audio/mpeg\")
941 (insert \"a fake mp3 file\")"
942 notmuch_counter_reset
943 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
944 (notmuch-show \"id:$id\"))"
945 test_expect_equal $(notmuch_counter_value) 1
947 test_begin_subtest "notmuch-hello-mode hook is called"
948 counter=$(test_emacs \
949 '(let ((notmuch-hello-mode-hook-counter 0))
950 (kill-buffer "*notmuch-hello*")
952 notmuch-hello-mode-hook-counter)'
954 test_expect_equal "$counter" 1
956 test_begin_subtest "notmuch-hello-mode hook is not called on updates"
957 counter=$(test_emacs \
958 '(let ((notmuch-hello-mode-hook-counter 0))
959 (kill-buffer "*notmuch-hello*")
961 (notmuch-hello-update)
962 notmuch-hello-mode-hook-counter)'
964 test_expect_equal "$counter" 1
966 test_begin_subtest "notmuch-hello-refresh hook is called"
967 counter=$(test_emacs \
968 '(let ((notmuch-hello-refresh-hook-counter 0))
969 (kill-buffer "*notmuch-hello*")
971 notmuch-hello-refresh-hook-counter)'
973 test_expect_equal "$counter" 1
975 test_begin_subtest "notmuch-hello-refresh hook is called on updates"
976 counter=$(test_emacs \
977 '(let ((notmuch-hello-refresh-hook-counter 0))
978 (kill-buffer "*notmuch-hello*")
980 (notmuch-hello-update)
981 notmuch-hello-refresh-hook-counter)'
983 test_expect_equal "$counter" 2
986 add_message '[subject]="HTML mail with images"' \
987 '[content-type]="multipart/related; boundary=abcd"' \
989 Content-Type: text/html
991 <img src="cid:330@goomoji.gmail"> smiley
994 Content-Type: image/gif
995 Content-Transfer-Encoding: base64
996 Content-ID: <330@goomoji.gmail>
998 R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMl
999 WLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7
1001 test_emacs "(let ((mm-text-html-renderer
1002 (if (assq 'shr mm-text-html-renderer-alist)
1004 (notmuch-show \"id:${gen_msg_id}\"))
1005 (test-output)" > /dev/null
1006 # Different Emacs versions and renderers give very different results,
1007 # so just check that something reasonable showed up. We first cat the
1008 # output so the test framework will print it if the test fails.
1009 test_begin_subtest "Rendering HTML mail with images"
1010 test_expect_success 'cat OUTPUT && grep -q smiley OUTPUT'
1012 test_begin_subtest "Search handles subprocess error exit codes"
1013 cat > notmuch_fail <<EOF
1018 chmod a+x notmuch_fail
1019 test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
1020 (with-current-buffer \"*Messages*\"
1021 (let ((inhibit-read-only t)) (erase-buffer)))
1022 (with-current-buffer (get-buffer-create \"*Notmuch errors*\")
1024 (notmuch-search \"tag:inbox\")
1026 (with-current-buffer \"*Messages*\"
1027 (test-output \"MESSAGES\"))
1028 (with-current-buffer \"*Notmuch errors*\"
1029 (test-output \"ERROR\"))
1032 test_expect_equal "$(notmuch_emacs_error_sanitize notmuch_fail OUTPUT MESSAGES ERROR)" "\
1034 End of search results.
1036 YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
1039 YYY/notmuch_fail exited with status 1
1040 command: YYY/notmuch_fail search --format\=sexp --format-version\=4 --sort\=newest-first tag\:inbox
1043 test_begin_subtest "Search handles subprocess warnings"
1044 cat > notmuch_fail <<EOF
1047 echo This is a warning >&2
1048 echo This is another warning >&2
1051 chmod a+x notmuch_fail
1052 test_emacs "(let ((notmuch-command \"$PWD/notmuch_fail\"))
1053 (with-current-buffer \"*Messages*\"
1054 (let ((inhibit-read-only t)) (erase-buffer)))
1055 (with-current-buffer (get-buffer-create \"*Notmuch errors*\")
1057 (notmuch-search \"tag:inbox\")
1059 (with-current-buffer \"*Messages*\"
1060 (test-output \"MESSAGES\"))
1061 (with-current-buffer \"*Notmuch errors*\"
1062 (test-output \"ERROR\"))
1064 sed -i -e 's/^\[.*\]$/[XXX]/' ERROR
1065 test_expect_equal "$(cat OUTPUT; echo ---; cat MESSAGES; echo ---; cat ERROR)" "\
1066 End of search results.
1068 This is a warning (see *Notmuch errors* for more details)
1072 This is another warning"
1074 test_begin_subtest "Search thread tag operations are race-free"
1075 add_message '[subject]="Search race test"'
1076 gen_msg_id_1=$gen_msg_id
1077 generate_message '[in-reply-to]="<'$gen_msg_id_1'>"' \
1078 '[references]="<'$gen_msg_id_1'>"' \
1079 '[subject]="Search race test two"'
1080 test_emacs '(notmuch-search "subject:\"search race test\"")
1083 (execute-kbd-macro "+search-thread-race-tag")'
1084 output=$(notmuch search --output=messages 'tag:search-thread-race-tag')
1085 test_expect_equal "$output" "id:$gen_msg_id_1"
1087 test_begin_subtest "Search global tag operations are race-free"
1088 generate_message '[in-reply-to]="<'$gen_msg_id_1'>"' \
1089 '[references]="<'$gen_msg_id_1'>"' \
1090 '[subject]="Re: Search race test"'
1091 test_emacs '(notmuch-search "subject:\"search race test\" -subject:two")
1094 (execute-kbd-macro "*+search-global-race-tag")'
1095 output=$(notmuch search --output=messages 'tag:search-global-race-tag')
1096 test_expect_equal "$output" "id:$gen_msg_id_1"
1098 test_begin_subtest "Term escaping"
1099 output=$(test_emacs "(mapcar 'notmuch-escape-boolean-term (list
1101 \"abc\`~\!@#\$%^&*-=_+123\"
1106 \"\\x201cxyz\\x201d\"))")
1107 test_expect_equal "$output" '("\"\"" "abc`~!@#$%^&*-=_+123" "\"(abc\"" "\")abc\"" "\"\"\"abc\"" "\"'$'\x01''xyz\"" "\"“xyz”\"")'
1109 test_begin_subtest "Sending a message calls the send message hooks"
1110 emacs_deliver_message \
1111 'Testing message sending hooks' \
1112 'This is a test of the message sending hooks.' \
1115 (insert \"To: user@example.com\n\")
1116 (add-hook 'notmuch-mua-send-hook (lambda () (goto-char (point-max)) (insert \"\nThis text added by the hook.\")))"
1118 -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' \
1119 -e s',^\(Content-Type: text/plain\); charset=us-ascii$,\1,' < sent_message >OUTPUT
1121 From: Notmuch Test Suite <test_suite@notmuchmail.org>
1122 To: user@example.com
1123 Subject: Testing message sending hooks
1124 Date: 01 Jan 2000 12:00:00 -0000
1127 Content-Type: text/plain
1129 This is a test of the message sending hooks.
1130 This text added by the hook.
1132 test_expect_equal_file EXPECTED OUTPUT