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