3 test_description="emacs interface"
6 EXPECTED=$TEST_DIRECTORY/emacs.expected-output
10 test_begin_subtest "Basic notmuch-hello view in emacs"
11 test_emacs '(notmuch-hello)
13 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
15 test_begin_subtest "Saved search with 0 results"
16 test_emacs '(let ((notmuch-show-empty-saved-searches t)
17 (notmuch-saved-searches
18 '\''(("inbox" . "tag:inbox")
19 ("unread" . "tag:unread")
20 ("empty" . "tag:doesnotexist"))))
23 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
25 test_begin_subtest "No saved searches displayed (all with 0 results)"
26 test_emacs '(let ((notmuch-saved-searches
27 '\''(("empty" . "tag:doesnotexist"))))
30 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
32 test_begin_subtest "Basic notmuch-search view in emacs"
33 test_emacs '(notmuch-search "tag:inbox")
36 test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox
38 test_begin_subtest "Incremental parsing of search results"
39 test_emacs "(ad-enable-advice 'notmuch-search-process-filter 'around 'pessimal)
40 (ad-activate 'notmuch-search-process-filter)
41 (notmuch-search \"tag:inbox\")
43 (ad-disable-advice 'notmuch-search-process-filter 'around 'pessimal)
44 (ad-activate 'notmuch-search-process-filter)
46 test_expect_equal_file OUTPUT $EXPECTED/notmuch-search-tag-inbox
48 test_begin_subtest "Navigation of notmuch-hello to search results"
49 test_emacs '(notmuch-hello)
50 (goto-char (point-min))
51 (re-search-forward "inbox")
52 (widget-button-press (1- (point)))
55 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox
57 test_begin_subtest "Basic notmuch-show view in emacs"
58 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
59 test_emacs "(notmuch-show \"$maildir_storage_thread\")
61 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
63 test_begin_subtest "Basic notmuch-show view in emacs default indentation"
64 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
65 test_emacs "(let ((notmuch-show-indent-messages-width 1))
66 (notmuch-show \"$maildir_storage_thread\")
68 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
70 test_begin_subtest "Basic notmuch-show view in emacs without indentation"
71 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
72 test_emacs "(let ((notmuch-show-indent-messages-width 0))
73 (notmuch-show \"$maildir_storage_thread\")
75 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage-without-indentation
77 test_begin_subtest "Basic notmuch-show view in emacs with fourfold indentation"
78 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
79 test_emacs "(let ((notmuch-show-indent-messages-width 4))
80 (notmuch-show \"$maildir_storage_thread\")
82 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation
84 test_begin_subtest "notmuch-show for message with invalid From"
85 add_message "[subject]=\"message-with-invalid-from\"" \
86 "[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
87 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
88 test_emacs "(notmuch-show \"$thread\")
91 "Invalid " (2001-01-05) (inbox)
92 Subject: message-with-invalid-from
93 To: Notmuch Test Suite <test_suite@notmuchmail.org>
94 Date: Fri, 05 Jan 2001 15:43:57 +0000
96 This is just a test message (#1)
98 test_expect_equal_file OUTPUT EXPECTED
100 test_begin_subtest "Navigation of notmuch-search to thread view"
101 test_emacs '(notmuch-search "tag:inbox")
103 (goto-char (point-min))
104 (re-search-forward "Working with Maildir")
105 (notmuch-search-show-thread)
108 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
110 test_begin_subtest "Add tag from search view"
111 os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com)
112 test_emacs "(notmuch-search \"$os_x_darwin_thread\")
114 (execute-kbd-macro \"+tag-from-search-view\")"
115 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
116 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)"
118 test_begin_subtest "Remove tag from search view"
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 unread)"
125 test_begin_subtest "Add tag from notmuch-show view"
126 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
127 (execute-kbd-macro \"+tag-from-show-view\")"
128 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
129 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)"
131 test_begin_subtest "Remove tag from notmuch-show view"
132 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
133 (execute-kbd-macro \"-tag-from-show-view\")"
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 unread)"
137 test_begin_subtest "Message with .. in Message-Id:"
138 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
139 test_emacs '(notmuch-search "id:\"123..456@example\"")
141 (execute-kbd-macro "+search-add")
142 (execute-kbd-macro "+search-remove")
143 (execute-kbd-macro "-search-remove")
144 (notmuch-show "id:\"123..456@example\"")
146 (execute-kbd-macro "+show-add")
147 (execute-kbd-macro "+show-remove")
148 (execute-kbd-macro "-show-remove")'
149 output=$(notmuch search 'id:"123..456@example"' | notmuch_search_sanitize)
150 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Message with .. in Message-Id (inbox search-add show-add)"
152 test_begin_subtest "Message with quote in Message-Id:"
153 add_message '[id]="\"quote\"@example"' '[subject]="Message with quote in Message-Id"'
154 test_emacs '(notmuch-search "subject:\"Message with quote\"")
156 (execute-kbd-macro "+search-add")
157 (notmuch-search-show-thread)
159 (execute-kbd-macro "+show-add")'
160 output=$(notmuch search 'id:"""quote""@example"' | notmuch_search_sanitize)
161 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)"
163 test_begin_subtest "Sending a message via (fake) SMTP"
164 emacs_deliver_message \
165 'Testing message sent via SMTP' \
166 'This is a test that messages are sent via SMTP' \
169 (insert "To: user@example.com\n")'
171 -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
172 -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' \
173 -e s',^\(Content-Type: text/plain\); charset=us-ascii$,\1,' < sent_message >OUTPUT
175 From: Notmuch Test Suite <test_suite@notmuchmail.org>
177 Subject: Testing message sent via SMTP
178 Date: 01 Jan 2000 12:00:00 -0000
179 User-Agent: Notmuch/XXX Emacs/XXX
182 Content-Type: text/plain
184 This is a test that messages are sent via SMTP
186 test_expect_equal_file OUTPUT EXPECTED
188 test_begin_subtest "Verify that sent messages are saved/searchable (via FCC)"
189 notmuch new > /dev/null
190 output=$(notmuch search 'subject:"testing message sent via SMTP"' | notmuch_search_sanitize)
191 test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
193 test_begin_subtest "notmuch-fcc-dirs set to nil"
194 test_emacs "(let ((notmuch-fcc-dirs nil))
198 From: Notmuch Test Suite <test_suite@notmuchmail.org>
201 --text follows this line--
203 test_expect_equal_file OUTPUT EXPECTED
205 # Make another FCC maildir specific for the next test
206 mkdir -p mail/sent-string/cur
207 mkdir -p mail/sent-string/new
208 mkdir -p mail/sent-string/tmp
210 test_begin_subtest "notmuch-fcc-dirs set to a string"
211 test_emacs "(let ((notmuch-fcc-dirs \"sent-string\"))
215 From: Notmuch Test Suite <test_suite@notmuchmail.org>
218 Fcc: ${MAIL_DIR}/sent-string
219 --text follows this line--
221 test_expect_equal_file OUTPUT EXPECTED
223 # Make more FCC maildirs specific for the next test
224 mkdir -p mail/sent-list-match/cur
225 mkdir -p mail/sent-list-match/new
226 mkdir -p mail/sent-list-match/tmp
227 mkdir -p mail/failure/cur
228 mkdir -p mail/failure/new
229 mkdir -p mail/failure/tmp
231 test_begin_subtest "notmuch-fcc-dirs set to a list (with match)"
232 test_emacs "(let ((notmuch-fcc-dirs
233 '((\"notmuchmail.org\" . \"sent-list-match\")
234 (\".*\" . \"failure\"))))
238 From: Notmuch Test Suite <test_suite@notmuchmail.org>
241 Fcc: ${MAIL_DIR}/sent-list-match
242 --text follows this line--
244 test_expect_equal_file OUTPUT EXPECTED
246 # Make another FCC maildir specific for the next test
247 mkdir -p mail/sent-list-catch-all/cur
248 mkdir -p mail/sent-list-catch-all/new
249 mkdir -p mail/sent-list-catch-all/tmp
251 test_begin_subtest "notmuch-fcc-dirs set to a list (catch-all)"
252 test_emacs "(let ((notmuch-fcc-dirs
253 '((\"example.com\" . \"failure\")
254 (\".*\" . \"sent-list-catch-all\"))))
258 From: Notmuch Test Suite <test_suite@notmuchmail.org>
261 Fcc: ${MAIL_DIR}/sent-list-catch-all
262 --text follows this line--
264 test_expect_equal_file OUTPUT EXPECTED
266 test_begin_subtest "notmuch-fcc-dirs set to a list (no match)"
267 test_emacs "(let ((notmuch-fcc-dirs
268 '((\"example.com\" . \"failure\")
269 (\"nomatchhere.net\" . \"failure\"))))
273 From: Notmuch Test Suite <test_suite@notmuchmail.org>
276 --text follows this line--
278 test_expect_equal_file OUTPUT EXPECTED
280 test_begin_subtest "Reply within emacs"
281 test_emacs '(let ((message-hidden-headers ''()))
282 (notmuch-search "subject:\"testing message sent via SMTP\"")
284 (notmuch-search-reply-to-thread)
286 sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
287 sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT
288 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
290 From: Notmuch Test Suite <test_suite@notmuchmail.org>
292 Subject: Re: Testing message sent via SMTP
294 Fcc: ${MAIL_DIR}/sent
296 User-Agent: Notmuch/XXX Emacs/XXX
297 --text follows this line--
298 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
300 > This is a test that messages are sent via SMTP
302 test_expect_equal_file OUTPUT EXPECTED
304 test_begin_subtest "Reply from alternate address within emacs"
305 add_message '[from]="Sender <sender@example.com>"' \
306 [to]=test_suite_other@notmuchmail.org
308 test_emacs "(let ((message-hidden-headers '()))
309 (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
311 (notmuch-search-reply-to-thread)
313 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
315 From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
316 To: Sender <sender@example.com>
317 Subject: Re: ${test_subtest_name}
318 In-Reply-To: <${gen_msg_id}>
319 Fcc: ${MAIL_DIR}/sent
320 References: <${gen_msg_id}>
321 User-Agent: Notmuch/XXX Emacs/XXX
322 --text follows this line--
323 Sender <sender@example.com> writes:
325 > This is just a test message (#${gen_msg_cnt})
327 test_expect_equal_file OUTPUT EXPECTED
329 test_begin_subtest "Reply from address in named group list within emacs"
330 add_message '[from]="Sender <sender@example.com>"' \
331 '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
332 [cc]=test_suite_other@notmuchmail.org
334 test_emacs "(let ((message-hidden-headers '()))
335 (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
337 (notmuch-search-reply-to-thread)
339 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
341 From: Notmuch Test Suite <test_suite@notmuchmail.org>
342 To: Sender <sender@example.com>, someone@example.com
343 Subject: Re: ${test_subtest_name}
344 In-Reply-To: <${gen_msg_id}>
345 Fcc: ${MAIL_DIR}/sent
346 References: <${gen_msg_id}>
347 User-Agent: Notmuch/XXX Emacs/XXX
348 --text follows this line--
349 Sender <sender@example.com> writes:
351 > This is just a test message (#${gen_msg_cnt})
353 test_expect_equal_file OUTPUT EXPECTED
355 test_begin_subtest "Reply within emacs to a multipart/mixed message"
356 test_emacs '(let ((message-hidden-headers ''()))
357 (notmuch-show "id:20091118002059.067214ed@hikari")
360 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
362 From: Notmuch Test Suite <test_suite@notmuchmail.org>
363 To: Adrian Perez de Castro <aperez@igalia.com>, notmuch@notmuchmail.org
364 Subject: Re: [notmuch] Introducing myself
365 In-Reply-To: <20091118002059.067214ed@hikari>
366 Fcc: ${MAIL_DIR}/sent
367 References: <20091118002059.067214ed@hikari>
368 User-Agent: Notmuch/XXX Emacs/XXX
369 --text follows this line--
370 Adrian Perez de Castro <aperez@igalia.com> writes:
374 > I have just heard about Not Much today in some random Linux-related news
375 > site (LWN?), my name is Adrian Perez and I work as systems administrator
376 > (although I can do some code as well :P). I have always thought that the
377 > ideas behind Sup were great, but after some time using it, I got tired of
378 > the oddities that it has. I also do not like doing things like having to
379 > install Ruby just for reading and sorting mails. Some time ago I thought
380 > about doing something like Not Much and in fact I played a bit with the
381 > Python+Xapian and the Python+Whoosh combinations, because I find relaxing
382 > to code things in Python when I am not working and also it is installed
383 > by default on most distribution. I got to have some mailboxes indexed and
384 > basic searching working a couple of months ago. Lately I have been very
385 > busy and had no time for coding, and them... boom! Not Much appears -- and
386 > it is almost exactly what I was trying to do, but faster. I have been
387 > playing a bit with Not Much today, and I think it has potential.
389 > Also, I would like to share one idea I had in mind, that you might find
390 > interesting: One thing I have found very annoying is having to re-tag my
391 > mail when the indexes get b0rked (it happened a couple of times to me while
392 > using Sup), so I was planning to mails as read/unread and adding the tags
393 > not just to the index, but to the mail text itself, e.g. by adding a
394 > "X-Tags" header field or by reusing the "Keywords" one. This way, the index
395 > could be totally recreated by re-reading the mail directories, and this
396 > would also allow to a tools like OfflineIMAP [1] to get the mails into a
397 > local maildir, tagging and indexing the mails with the e-mail reader and
398 > then syncing back the messages with the "X-Tags" header to the IMAP server.
399 > This would allow to use the mail reader from a different computer and still
400 > have everything tagged finely.
406 > [1] http://software.complete.org/software/projects/show/offlineimap
409 > Adrian Perez de Castro <aperez@igalia.com>
410 > Igalia - Free Software Engineering
411 > _______________________________________________
412 > notmuch mailing list
413 > notmuch@notmuchmail.org
414 > http://notmuchmail.org/mailman/listinfo/notmuch
416 test_expect_equal_file OUTPUT EXPECTED
418 test_begin_subtest "Reply within emacs to a multipart/alternative message"
419 test_emacs '(let ((message-hidden-headers ''()))
420 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
423 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
425 From: Notmuch Test Suite <test_suite@notmuchmail.org>
426 To: Alex Botero-Lowry <alex.boterolowry@gmail.com>, notmuch@notmuchmail.org
427 Subject: Re: [notmuch] preliminary FreeBSD support
428 In-Reply-To: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
429 Fcc: ${MAIL_DIR}/sent
430 References: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
431 User-Agent: Notmuch/XXX Emacs/XXX
432 --text follows this line--
433 Alex Botero-Lowry <alex.boterolowry@gmail.com> writes:
435 > I saw the announcement this morning, and was very excited, as I had been
436 > hoping sup would be turned into a library,
437 > since I like the concept more than the UI (I'd rather an emacs interface).
439 > I did a preliminary compile which worked out fine, but
440 > sysconf(_SC_SC_GETPW_R_SIZE_MAX) returns -1 on
441 > FreeBSD, so notmuch_config_open segfaulted.
443 > Attached is a patch that supplies a default buffer size of 64 in cases where
446 > http://www.opengroup.org/austin/docs/austin_328.txt - seems to indicate this
447 > is acceptable behavior,
448 > and http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/07/msg016808.htmlspecifically
451 > _______________________________________________
452 > notmuch mailing list
453 > notmuch@notmuchmail.org
454 > http://notmuchmail.org/mailman/listinfo/notmuch
456 test_expect_equal_file OUTPUT EXPECTED
458 test_begin_subtest "Reply within emacs to an html-only message"
459 add_message '[content-type]="text/html"' \
460 '[body]="Hi,<br />This is an <b>HTML</b> test message.<br /><br />OK?"'
461 test_emacs "(let ((message-hidden-headers '()) (mm-text-html-renderer 'html2text))
462 (notmuch-show \"id:${gen_msg_id}\")
465 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
467 From: Notmuch Test Suite <test_suite@notmuchmail.org>
469 Subject: Re: Reply within emacs to an html-only message
470 In-Reply-To: <${gen_msg_id}>
471 Fcc: ${MAIL_DIR}/sent
472 References: <${gen_msg_id}>
473 User-Agent: Notmuch/XXX Emacs/XXX
474 --text follows this line--
475 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
477 > Hi,This is an HTML test message.OK?
479 test_expect_equal_file OUTPUT EXPECTED
481 test_begin_subtest "Quote MML tags in reply"
482 message_id='test-emacs-mml-quoting@message.id'
483 add_message [id]="$message_id" \
484 "[subject]='$test_subtest_name'" \
485 '[body]="<#part disposition=inline>"'
486 test_emacs "(let ((message-hidden-headers '()))
487 (notmuch-show \"id:$message_id\")
490 sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT
492 From: Notmuch Test Suite <test_suite@notmuchmail.org>
494 Subject: Re: Quote MML tags in reply
495 In-Reply-To: <test-emacs-mml-quoting@message.id>
496 Fcc: ${MAIL_DIR}/sent
497 References: <test-emacs-mml-quoting@message.id>
498 User-Agent: Notmuch/XXX Emacs/XXX
499 --text follows this line--
500 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
502 > <#!part disposition=inline>
504 test_expect_equal_file OUTPUT EXPECTED
506 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments"
507 # save as archive to test that Emacs does not re-compress .gz
508 test_emacs '(let ((standard-input "\"attachment1.gz\""))
509 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
510 (notmuch-show-save-attachments))'
511 test_expect_equal_file attachment1.gz "$EXPECTED/attachment"
513 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part"
514 # save as archive to test that Emacs does not re-compress .gz
515 test_emacs '(let ((standard-input "\"attachment2.gz\""))
516 (notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com" 5))'
517 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"
519 test_begin_subtest "View raw message within emacs"
520 test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
521 (notmuch-show-view-raw-message)
523 test_expect_equal_file OUTPUT $EXPECTED/raw-message-cf0c4d-52ad0a
525 test_begin_subtest "Hiding/showing signature in notmuch-show view"
526 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
527 test_emacs "(notmuch-show \"$maildir_storage_thread\")
528 (search-forward \"Click/Enter to show.\")
529 (button-activate (button-at (point)))
530 (search-backward \"Click/Enter to hide.\")
531 (button-activate (button-at (point)))
533 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
535 test_begin_subtest "Detection and hiding of top-post quoting of message"
536 add_message '[subject]="The problem with top-posting"' \
537 [id]=top-post-target \
538 '[body]="A: Because it messes up the order in which people normally read text.
539 Q: Why is top-posting such a bad thing?
541 Q: What is the most annoying thing in e-mail?"'
542 add_message '[from]="Top Poster <top@poster.com>"' \
543 [in-reply-to]=top-post-target \
544 [references]=top-post-target \
545 '[subject]="Re: The problem with top-posting"' \
546 '[body]="Thanks for the advice! I will be sure to put it to good use.
550 ----- Original Message -----
551 From: Notmuch Test Suite <test_suite@notmuchmail.org>
552 To: Notmuch Test Suite <test_suite@notmuchmai.org>
553 Sent: Fri, 05 Jan 2001 15:43:57 +0000
554 Subject: The problem with top-posting
556 Q: Why is top-posting such a bad thing?
558 Q: What is the most annoying thing in e-mail?"'
559 test_emacs "(notmuch-show \"top-posting\")
560 (test-visible-output)"
561 echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
562 Subject: The problem with top-posting
563 To: Notmuch Test Suite <test_suite@notmuchmail.org>
564 Date: Fri, 05 Jan 2001 15:43:57 +0000
566 A: Because it messes up the order in which people normally read text.
567 Q: Why is top-posting such a bad thing?
569 Q: What is the most annoying thing in e-mail?
570 Top Poster <top@poster.com> (2001-01-05) (inbox unread)
571 Subject: Re: The problem with top-posting
572 To: Notmuch Test Suite <test_suite@notmuchmail.org>
573 Date: Fri, 05 Jan 2001 15:43:57 +0000
575 Thanks for the advice! I will be sure to put it to good use.
579 [ 9-line hidden original message. Click/Enter to show. ]" > EXPECTED
580 test_expect_equal_file OUTPUT EXPECTED
582 test_begin_subtest "Hiding message in notmuch-show view"
583 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
584 (notmuch-show-toggle-message)
585 (test-visible-output)'
586 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
588 test_begin_subtest "Hiding message with visible citation in notmuch-show view"
589 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
590 (search-forward "Click/Enter to show.")
591 (button-activate (button-at (point)))
592 (notmuch-show-toggle-message)
593 (test-visible-output)'
594 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
596 test_begin_subtest "notmuch-show: show message headers"
598 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
599 (notmuch-message-headers-visible t))
600 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
601 (test-visible-output))'
602 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-visible
604 test_begin_subtest "notmuch-show: hide message headers"
606 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
607 (notmuch-message-headers-visible nil))
608 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
609 (test-visible-output))'
610 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden
612 test_begin_subtest "notmuch-show: hide message headers (w/ notmuch-show-toggle-visibility-headers)"
614 '(let ((notmuch-message-headers '\''("Subject" "To" "Cc" "Date"))
615 (notmuch-message-headers-visible t))
616 (notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
617 (notmuch-show-toggle-visibility-headers)
618 (test-visible-output))'
619 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden
621 test_begin_subtest "notmuch-show: collapse all messages in thread"
622 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")
623 (let ((current-prefix-arg t))
624 (notmuch-show-open-or-close-all)
625 (test-visible-output))'
626 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-collapsed
628 test_begin_subtest "notmuch-show: uncollapse all messages in thread"
629 test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")
630 (notmuch-show-open-or-close-all)
631 (test-visible-output)'
632 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed
634 test_begin_subtest "Stashing in notmuch-show"
635 add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
636 '[from]="Some One <someone@somewhere.org>"' \
637 '[to]="Some One Else <notsomeone@somewhere.org>"' \
638 '[cc]="Notmuch <notmuch@notmuchmail.org>"' \
639 '[subject]="Stash my stashables"' \
641 '[body]="Unable to stash body. Where did you get it in the first place?!?"'
642 notmuch tag +stashtest id:${gen_msg_id}
643 test_emacs '(notmuch-show "id:\"bought\"")
644 (notmuch-show-stash-date)
645 (notmuch-show-stash-from)
646 (notmuch-show-stash-to)
647 (notmuch-show-stash-cc)
648 (notmuch-show-stash-subject)
649 (notmuch-show-stash-message-id)
650 (notmuch-show-stash-message-id-stripped)
651 (notmuch-show-stash-tags)
652 (notmuch-show-stash-filename)
653 (notmuch-show-stash-mlarchive-link "Gmane")
654 (notmuch-show-stash-mlarchive-link "MARC")
655 (notmuch-show-stash-mlarchive-link "Mail Archive, The")
657 (generate-new-buffer "*test-stashing*"))
661 (rotate-yank-pointer 1))
662 (reverse-region (point-min) (point-max))
665 Sat, 01 Jan 2000 12:00:00 +0000
666 Some One <someone@somewhere.org>
667 Some One Else <notsomeone@somewhere.org>
668 Notmuch <notmuch@notmuchmail.org>
674 http://mid.gmane.org/bought
675 http://marc.info/?i=bought
676 http://mail-archive.com/search?l=mid&q=bought
678 test_expect_equal_file OUTPUT EXPECTED
680 test_begin_subtest "Stashing in notmuch-search"
681 test_emacs '(notmuch-search "id:\"bought\"")
683 (notmuch-search-stash-thread-id)
685 (generate-new-buffer "*test-stashing*"))
688 sed -i -e 's/^thread:.*$/thread:XXX/' OUTPUT
689 test_expect_equal "$(cat OUTPUT)" "thread:XXX"
691 test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
692 message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu'
693 message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net'
694 test_emacs "(notmuch-show \"$message2\")
695 (test-output \"EXPECTED\")"
696 test_emacs "(notmuch-search \"$message1 or $message2\")
698 (notmuch-search-show-thread)
699 (goto-char (point-max))
701 (notmuch-show-advance-and-archive)
703 test_expect_equal_file OUTPUT EXPECTED
705 test_begin_subtest "Refresh show buffer"
706 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
707 (test-visible-output "EXPECTED")
708 (notmuch-show-refresh-view)
709 (test-visible-output)'
710 test_expect_equal_file OUTPUT EXPECTED
712 test_begin_subtest "Refresh modified show buffer"
713 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
714 (notmuch-show-toggle-message)
715 (notmuch-show-next-message)
716 (notmuch-show-toggle-message)
717 (test-visible-output "EXPECTED")
718 (notmuch-show-refresh-view)
719 (test-visible-output)'
720 test_expect_equal_file OUTPUT EXPECTED
722 test_begin_subtest "Do not call notmuch for non-inlinable application/mpeg parts"
723 id='message-with-application/mpeg-attachment@notmuchmail.org'
724 emacs_deliver_message \
725 'Message with application/mpeg attachment' \
728 (insert \"Message-ID: <$id>\n\")
730 (mml-insert-part \"application/mpeg\")
731 (insert \"a fake mp3 file\")"
732 notmuch_counter_reset
733 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
734 (notmuch-show \"id:$id\"))"
735 test_expect_equal $(notmuch_counter_value) 1
737 test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts"
738 id='message-with-audio/mpeg-attachment@notmuchmail.org'
739 emacs_deliver_message \
740 'Message with audio/mpeg attachment' \
743 (insert \"Message-ID: <$id>\n\")
745 (mml-insert-part \"audio/mpeg\")
746 (insert \"a fake mp3 file\")"
747 notmuch_counter_reset
748 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
749 (notmuch-show \"id:$id\"))"
750 test_expect_equal $(notmuch_counter_value) 1
752 test_begin_subtest "notmuch-hello-mode hook is called"
753 counter=$(test_emacs \
754 '(let ((notmuch-hello-mode-hook-counter 0))
755 (kill-buffer "*notmuch-hello*")
757 notmuch-hello-mode-hook-counter)'
759 test_expect_equal "$counter" 1
761 test_begin_subtest "notmuch-hello-mode hook is not called on updates"
762 counter=$(test_emacs \
763 '(let ((notmuch-hello-mode-hook-counter 0))
764 (kill-buffer "*notmuch-hello*")
766 (notmuch-hello-update)
767 notmuch-hello-mode-hook-counter)'
769 test_expect_equal "$counter" 1
771 test_begin_subtest "notmuch-hello-refresh hook is called"
772 counter=$(test_emacs \
773 '(let ((notmuch-hello-refresh-hook-counter 0))
774 (kill-buffer "*notmuch-hello*")
776 notmuch-hello-refresh-hook-counter)'
778 test_expect_equal "$counter" 1
780 test_begin_subtest "notmuch-hello-refresh hook is called on updates"
781 counter=$(test_emacs \
782 '(let ((notmuch-hello-refresh-hook-counter 0))
783 (kill-buffer "*notmuch-hello*")
785 (notmuch-hello-update)
786 notmuch-hello-refresh-hook-counter)'
788 test_expect_equal "$counter" 2
791 add_message '[subject]="HTML mail with images"' \
792 '[content-type]="multipart/related; boundary=abcd"' \
794 Content-Type: text/html
796 <img src="cid:330@goomoji.gmail"> smiley
799 Content-Type: image/gif
800 Content-Transfer-Encoding: base64
801 Content-ID: <330@goomoji.gmail>
803 R0lGODlhDAAMAKIFAF5LAP/zxAAAANyuAP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMl
804 WLPcGjDKFYi9lxKBOaGcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7
806 test_emacs "(let ((mm-text-html-renderer
807 (if (assq 'shr mm-text-html-renderer-alist)
809 (notmuch-show \"id:${gen_msg_id}\"))
810 (test-output)" > /dev/null
811 # Different Emacs versions and renderers give very different results,
812 # so just check that something reasonable showed up. We first cat the
813 # output so the test framework will print it if the test fails.
814 test_expect_success "Rendering HTML mail with images" \
815 'cat OUTPUT && grep -q smiley OUTPUT'