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