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 "Navigation of notmuch-hello to search results"
39 test_emacs '(notmuch-hello)
40 (goto-char (point-min))
41 (re-search-forward "inbox")
42 (widget-button-press (point))
45 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-view-inbox
47 test_begin_subtest "Basic notmuch-show view in emacs"
48 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
49 test_emacs "(notmuch-show \"$maildir_storage_thread\")
51 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
53 test_begin_subtest "Basic notmuch-show view in emacs default indentation"
54 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
55 test_emacs "(let ((notmuch-show-indent-messages-width 1))
56 (notmuch-show \"$maildir_storage_thread\")
58 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
60 test_begin_subtest "Basic notmuch-show view in emacs without indentation"
61 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
62 test_emacs "(let ((notmuch-show-indent-messages-width 0))
63 (notmuch-show \"$maildir_storage_thread\")
65 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage-without-indentation
67 test_begin_subtest "Basic notmuch-show view in emacs with fourfold 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 4))
70 (notmuch-show \"$maildir_storage_thread\")
72 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation
74 test_begin_subtest "notmuch-show for message with invalid From"
75 add_message "[subject]=\"message-with-invalid-from\"" \
76 "[from]=\"\\\"Invalid \\\" From\\\" <test_suite@notmuchmail.org>\""
77 thread=$(notmuch search --output=threads subject:message-with-invalid-from)
78 test_emacs "(notmuch-show \"$thread\")
81 "Invalid " (2001-01-05) (inbox)
82 Subject: message-with-invalid-from
83 To: Notmuch Test Suite <test_suite@notmuchmail.org>
84 Date: Fri, 05 Jan 2001 15:43:57 +0000
86 This is just a test message (#1)
88 test_expect_equal_file OUTPUT EXPECTED
90 test_begin_subtest "Navigation of notmuch-search to thread view"
91 test_emacs '(notmuch-search "tag:inbox")
93 (goto-char (point-min))
94 (re-search-forward "Working with Maildir")
95 (notmuch-search-show-thread)
98 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
100 test_begin_subtest "Add tag from search view"
101 os_x_darwin_thread=$(notmuch search --output=threads id:ddd65cda0911171950o4eea4389v86de9525e46052d3@mail.gmail.com)
102 test_emacs "(notmuch-search \"$os_x_darwin_thread\")
104 (execute-kbd-macro \"+tag-from-search-view\")"
105 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
106 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)"
108 test_begin_subtest "Remove tag from search view"
109 test_emacs "(notmuch-search \"$os_x_darwin_thread\")
111 (execute-kbd-macro \"-tag-from-search-view\")"
112 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
113 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)"
115 test_begin_subtest "Add tag from notmuch-show view"
116 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
117 (execute-kbd-macro \"+tag-from-show-view\")"
118 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
119 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)"
121 test_begin_subtest "Remove tag from notmuch-show view"
122 test_emacs "(notmuch-show \"$os_x_darwin_thread\")
123 (execute-kbd-macro \"-tag-from-show-view\")"
124 output=$(notmuch search $os_x_darwin_thread | notmuch_search_sanitize)
125 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)"
127 test_begin_subtest "Message with .. in Message-Id:"
128 add_message [id]=123..456@example '[subject]="Message with .. in Message-Id"'
129 test_emacs '(notmuch-search "id:\"123..456@example\"")
131 (execute-kbd-macro "+search-add")
132 (execute-kbd-macro "+search-remove")
133 (execute-kbd-macro "-search-remove")
134 (notmuch-show "id:\"123..456@example\"")
136 (execute-kbd-macro "+show-add")
137 (execute-kbd-macro "+show-remove")
138 (execute-kbd-macro "-show-remove")'
139 output=$(notmuch search 'id:"123..456@example"' | notmuch_search_sanitize)
140 test_expect_equal "$output" "thread:XXX 2001-01-05 [1/1] Notmuch Test Suite; Message with .. in Message-Id (inbox search-add show-add)"
142 test_begin_subtest "Message with quote in Message-Id:"
143 test_subtest_known_broken
144 add_message '[id]="\"quote\"@example"' '[subject]="Message with quote in Message-Id"'
145 test_emacs '(notmuch-search "subject:\"Message with quote\"")
147 (execute-kbd-macro "+search-add")
148 (notmuch-search-show-thread)
150 (execute-kbd-macro "+show-add")'
151 output=$(notmuch search 'id:"""quote""@example"' | notmuch_search_sanitize)
152 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)"
154 test_begin_subtest "Sending a message via (fake) SMTP"
155 emacs_deliver_message \
156 'Testing message sent via SMTP' \
157 'This is a test that messages are sent via SMTP' \
160 (insert "To: user@example.com\n")'
162 -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
163 -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message >OUTPUT
165 From: Notmuch Test Suite <test_suite@notmuchmail.org>
167 Subject: Testing message sent via SMTP
168 Date: 01 Jan 2000 12:00:00 -0000
169 User-Agent: Notmuch/XXX Emacs/XXX
172 Content-Type: text/plain; charset=us-ascii
174 This is a test that messages are sent via SMTP
176 test_expect_equal_file OUTPUT EXPECTED
178 test_begin_subtest "Verify that sent messages are saved/searchable (via FCC)"
179 notmuch new > /dev/null
180 output=$(notmuch search 'subject:"testing message sent via SMTP"' | notmuch_search_sanitize)
181 test_expect_equal "$output" "thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; Testing message sent via SMTP (inbox)"
183 test_begin_subtest "notmuch-fcc-dirs set to nil"
184 test_emacs "(let ((notmuch-fcc-dirs nil))
188 From: Notmuch Test Suite <test_suite@notmuchmail.org>
191 --text follows this line--
193 test_expect_equal_file OUTPUT EXPECTED
195 # Make another FCC maildir specific for the next test
196 mkdir -p mail/sent-string/cur
197 mkdir -p mail/sent-string/new
198 mkdir -p mail/sent-string/tmp
200 test_begin_subtest "notmuch-fcc-dirs set to a string"
201 test_emacs "(let ((notmuch-fcc-dirs \"sent-string\"))
205 From: Notmuch Test Suite <test_suite@notmuchmail.org>
208 Fcc: ${MAIL_DIR}/sent-string
209 --text follows this line--
211 test_expect_equal_file OUTPUT EXPECTED
213 # Make more FCC maildirs specific for the next test
214 mkdir -p mail/sent-list-match/cur
215 mkdir -p mail/sent-list-match/new
216 mkdir -p mail/sent-list-match/tmp
217 mkdir -p mail/failure/cur
218 mkdir -p mail/failure/new
219 mkdir -p mail/failure/tmp
221 test_begin_subtest "notmuch-fcc-dirs set to a list (with match)"
222 test_emacs "(let ((notmuch-fcc-dirs
223 '((\"notmuchmail.org\" . \"sent-list-match\")
224 (\".*\" . \"failure\"))))
228 From: Notmuch Test Suite <test_suite@notmuchmail.org>
231 Fcc: ${MAIL_DIR}/sent-list-match
232 --text follows this line--
234 test_expect_equal_file OUTPUT EXPECTED
236 # Make another FCC maildir specific for the next test
237 mkdir -p mail/sent-list-catch-all/cur
238 mkdir -p mail/sent-list-catch-all/new
239 mkdir -p mail/sent-list-catch-all/tmp
241 test_begin_subtest "notmuch-fcc-dirs set to a list (catch-all)"
242 test_emacs "(let ((notmuch-fcc-dirs
243 '((\"example.com\" . \"failure\")
244 (\".*\" . \"sent-list-catch-all\"))))
248 From: Notmuch Test Suite <test_suite@notmuchmail.org>
251 Fcc: ${MAIL_DIR}/sent-list-catch-all
252 --text follows this line--
254 test_expect_equal_file OUTPUT EXPECTED
256 test_begin_subtest "notmuch-fcc-dirs set to a list (no match)"
257 test_emacs "(let ((notmuch-fcc-dirs
258 '((\"example.com\" . \"failure\")
259 (\"nomatchhere.net\" . \"failure\"))))
263 From: Notmuch Test Suite <test_suite@notmuchmail.org>
266 --text follows this line--
268 test_expect_equal_file OUTPUT EXPECTED
270 test_begin_subtest "Reply within emacs"
271 test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"")
273 (notmuch-search-reply-to-thread)
275 sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT
277 From: Notmuch Test Suite <test_suite@notmuchmail.org>
279 Subject: Re: Testing message sent via SMTP
281 Fcc: ${MAIL_DIR}/sent
282 --text follows this line--
283 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
285 > This is a test that messages are sent via SMTP
287 test_expect_equal_file OUTPUT EXPECTED
289 test_begin_subtest "Reply within emacs to a multipart/mixed message"
290 test_emacs '(notmuch-show "id:20091118002059.067214ed@hikari")
294 From: Notmuch Test Suite <test_suite@notmuchmail.org>
295 To: Adrian Perez de Castro <aperez@igalia.com>, notmuch@notmuchmail.org
296 Subject: Re: [notmuch] Introducing myself
297 In-Reply-To: <20091118002059.067214ed@hikari>
298 Fcc: ${MAIL_DIR}/sent
299 --text follows this line--
300 Adrian Perez de Castro <aperez@igalia.com> writes:
304 > I have just heard about Not Much today in some random Linux-related news
305 > site (LWN?), my name is Adrian Perez and I work as systems administrator
306 > (although I can do some code as well :P). I have always thought that the
307 > ideas behind Sup were great, but after some time using it, I got tired of
308 > the oddities that it has. I also do not like doing things like having to
309 > install Ruby just for reading and sorting mails. Some time ago I thought
310 > about doing something like Not Much and in fact I played a bit with the
311 > Python+Xapian and the Python+Whoosh combinations, because I find relaxing
312 > to code things in Python when I am not working and also it is installed
313 > by default on most distribution. I got to have some mailboxes indexed and
314 > basic searching working a couple of months ago. Lately I have been very
315 > busy and had no time for coding, and them... boom! Not Much appears -- and
316 > it is almost exactly what I was trying to do, but faster. I have been
317 > playing a bit with Not Much today, and I think it has potential.
319 > Also, I would like to share one idea I had in mind, that you might find
320 > interesting: One thing I have found very annoying is having to re-tag my
321 > mail when the indexes get b0rked (it happened a couple of times to me while
322 > using Sup), so I was planning to mails as read/unread and adding the tags
323 > not just to the index, but to the mail text itself, e.g. by adding a
324 > "X-Tags" header field or by reusing the "Keywords" one. This way, the index
325 > could be totally recreated by re-reading the mail directories, and this
326 > would also allow to a tools like OfflineIMAP [1] to get the mails into a
327 > local maildir, tagging and indexing the mails with the e-mail reader and
328 > then syncing back the messages with the "X-Tags" header to the IMAP server.
329 > This would allow to use the mail reader from a different computer and still
330 > have everything tagged finely.
336 > [1] http://software.complete.org/software/projects/show/offlineimap
339 > Adrian Perez de Castro <aperez@igalia.com>
340 > Igalia - Free Software Engineering
341 > _______________________________________________
342 > notmuch mailing list
343 > notmuch@notmuchmail.org
344 > http://notmuchmail.org/mailman/listinfo/notmuch
346 test_expect_equal_file OUTPUT EXPECTED
348 test_begin_subtest "Reply within emacs to a multipart/alternative message"
349 test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
353 From: Notmuch Test Suite <test_suite@notmuchmail.org>
354 To: Alex Botero-Lowry <alex.boterolowry@gmail.com>, notmuch@notmuchmail.org
355 Subject: Re: [notmuch] preliminary FreeBSD support
356 In-Reply-To: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com>
357 Fcc: ${MAIL_DIR}/sent
358 --text follows this line--
359 Alex Botero-Lowry <alex.boterolowry@gmail.com> writes:
361 > I saw the announcement this morning, and was very excited, as I had been
362 > hoping sup would be turned into a library,
363 > since I like the concept more than the UI (I'd rather an emacs interface).
365 > I did a preliminary compile which worked out fine, but
366 > sysconf(_SC_SC_GETPW_R_SIZE_MAX) returns -1 on
367 > FreeBSD, so notmuch_config_open segfaulted.
369 > Attached is a patch that supplies a default buffer size of 64 in cases where
372 > http://www.opengroup.org/austin/docs/austin_328.txt - seems to indicate this
373 > is acceptable behavior,
374 > and http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/07/msg016808.htmlspecifically
377 > _______________________________________________
378 > notmuch mailing list
379 > notmuch@notmuchmail.org
380 > http://notmuchmail.org/mailman/listinfo/notmuch
382 test_expect_equal_file OUTPUT EXPECTED
384 test_begin_subtest "Quote MML tags in reply"
385 message_id='test-emacs-mml-quoting@message.id'
386 add_message [id]="$message_id" \
387 "[subject]='$test_subtest_name'" \
388 '[body]="<#part disposition=inline>"'
389 test_emacs "(notmuch-show \"id:$message_id\")
393 From: Notmuch Test Suite <test_suite@notmuchmail.org>
395 Subject: Re: Quote MML tags in reply
396 In-Reply-To: <test-emacs-mml-quoting@message.id>
397 Fcc: ${MAIL_DIR}/sent
398 --text follows this line--
399 Notmuch Test Suite <test_suite@notmuchmail.org> writes:
401 > <#!part disposition=inline>
403 test_expect_equal_file OUTPUT EXPECTED
405 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-attachments"
406 # save as archive to test that Emacs does not re-compress .gz
407 test_emacs '(let ((standard-input "\"attachment1.gz\""))
408 (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
409 (notmuch-show-save-attachments))'
410 test_expect_equal_file attachment1.gz "$EXPECTED/attachment"
412 test_begin_subtest "Save attachment from within emacs using notmuch-show-save-part"
413 # save as archive to test that Emacs does not re-compress .gz
414 test_emacs '(let ((standard-input "\"attachment2.gz\""))
415 (notmuch-show-save-part "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com" 5))'
416 test_expect_equal_file attachment2.gz "$EXPECTED/attachment"
418 test_begin_subtest "View raw message within emacs"
419 test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a@mail.gmail.com")
420 (notmuch-show-view-raw-message)
422 test_expect_equal_file OUTPUT $EXPECTED/raw-message-cf0c4d-52ad0a
424 test_begin_subtest "Hiding/showing signature in notmuch-show view"
425 maildir_storage_thread=$(notmuch search --output=threads id:20091117190054.GU3165@dottiness.seas.harvard.edu)
426 test_emacs "(notmuch-show \"$maildir_storage_thread\")
427 (search-forward \"Click/Enter to show.\")
428 (button-activate (button-at (point)))
429 (search-backward \"Click/Enter to hide.\")
430 (button-activate (button-at (point)))
432 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-maildir-storage
434 test_begin_subtest "Detection and hiding of top-post quoting of message"
435 add_message '[subject]="The problem with top-posting"' \
436 [id]=top-post-target \
437 '[body]="A: Because it messes up the order in which people normally read text.
438 Q: Why is top-posting such a bad thing?
440 Q: What is the most annoying thing in e-mail?"'
441 add_message '[from]="Top Poster <top@poster.com>"' \
442 [in-reply-to]=top-post-target \
443 [references]=top-post-target \
444 '[subject]="Re: The problem with top-posting"' \
445 '[body]="Thanks for the advice! I will be sure to put it to good use.
449 ----- Original Message -----
450 From: Notmuch Test Suite <test_suite@notmuchmail.org>
451 To: Notmuch Test Suite <test_suite@notmuchmai.org>
452 Sent: Fri, 05 Jan 2001 15:43:57 +0000
453 Subject: The problem with top-posting
455 Q: Why is top-posting such a bad thing?
457 Q: What is the most annoying thing in e-mail?"'
458 test_emacs "(notmuch-show \"top-posting\")
459 (test-visible-output)"
460 echo "Notmuch Test Suite <test_suite@notmuchmail.org> (2001-01-05) (inbox)
461 Subject: The problem with top-posting
462 To: Notmuch Test Suite <test_suite@notmuchmail.org>
463 Date: Fri, 05 Jan 2001 15:43:57 +0000
465 A: Because it messes up the order in which people normally read text.
466 Q: Why is top-posting such a bad thing?
468 Q: What is the most annoying thing in e-mail?
469 Top Poster <top@poster.com> (2001-01-05) (inbox unread)
470 Subject: Re: The problem with top-posting
471 To: Notmuch Test Suite <test_suite@notmuchmail.org>
472 Date: Fri, 05 Jan 2001 15:43:57 +0000
474 Thanks for the advice! I will be sure to put it to good use.
478 [ 9-line hidden original message. Click/Enter to show. ]" > EXPECTED
479 test_expect_equal_file OUTPUT EXPECTED
481 test_begin_subtest "Hiding message in notmuch-show view"
482 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
483 (notmuch-show-toggle-message)
484 (test-visible-output)'
485 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
487 test_begin_subtest "Hiding message with visible citation in notmuch-show view"
488 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
489 (search-forward "Click/Enter to show.")
490 (button-activate (button-at (point)))
491 (notmuch-show-toggle-message)
492 (test-visible-output)'
493 test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
495 test_begin_subtest "Stashing in notmuch-show"
496 add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
497 '[from]="Some One <someone@somewhere.org>"' \
498 '[to]="Some One Else <notsomeone@somewhere.org>"' \
499 '[cc]="Notmuch <notmuch@notmuchmail.org>"' \
500 '[subject]="Stash my stashables"' \
502 '[body]="Unable to stash body. Where did you get it in the first place?!?"'
503 notmuch tag +stashtest id:${gen_msg_id}
504 test_emacs '(notmuch-show "id:\"bought\"")
505 (notmuch-show-stash-date)
506 (notmuch-show-stash-from)
507 (notmuch-show-stash-to)
508 (notmuch-show-stash-cc)
509 (notmuch-show-stash-subject)
510 (notmuch-show-stash-message-id)
511 (notmuch-show-stash-message-id-stripped)
512 (notmuch-show-stash-tags)
513 (notmuch-show-stash-filename)
514 (notmuch-show-stash-mlarchive-link "Gmane")
515 (notmuch-show-stash-mlarchive-link "MARC")
516 (notmuch-show-stash-mlarchive-link "Mail Archive, The")
518 (generate-new-buffer "*test-stashing*"))
522 (rotate-yank-pointer 1))
523 (reverse-region (point-min) (point-max))
526 Sat, 01 Jan 2000 12:00:00 +0000
527 Some One <someone@somewhere.org>
528 Some One Else <notsomeone@somewhere.org>
529 Notmuch <notmuch@notmuchmail.org>
535 http://mid.gmane.org/bought
536 http://marc.info/?i=bought
537 http://mail-archive.com/search?l=mid&q=bought
539 test_expect_equal_file OUTPUT EXPECTED
541 test_begin_subtest "Stashing in notmuch-search"
542 test_emacs '(notmuch-search "id:\"bought\"")
544 (notmuch-search-stash-thread-id)
546 (generate-new-buffer "*test-stashing*"))
549 sed -i -e 's/^thread:.*$/thread:XXX/' OUTPUT
550 test_expect_equal "$(cat OUTPUT)" "thread:XXX"
552 test_begin_subtest 'notmuch-show-advance-and-archive with invisible signature'
553 message1='id:20091118010116.GC25380@dottiness.seas.harvard.edu'
554 message2='id:1258491078-29658-1-git-send-email-dottedmag@dottedmag.net'
555 test_emacs "(notmuch-search \"$message1 or $message2\")
557 (notmuch-search-show-thread)
558 (goto-char (point-max))
560 (notmuch-show-advance-and-archive)
562 test_emacs "(notmuch-show \"$message2\")
563 (test-output \"EXPECTED\")"
564 test_expect_equal_file OUTPUT EXPECTED
566 test_begin_subtest "Refresh show buffer"
567 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
568 (test-visible-output "EXPECTED")
569 (notmuch-show-refresh-view)
570 (test-visible-output)'
571 test_expect_equal_file OUTPUT EXPECTED
573 test_begin_subtest "Refresh modified show buffer"
574 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
575 (notmuch-show-toggle-message)
576 (notmuch-show-next-message)
577 (notmuch-show-toggle-message)
578 (test-visible-output "EXPECTED")
579 (notmuch-show-refresh-view)
580 (test-visible-output)'
581 test_expect_equal_file OUTPUT EXPECTED
583 test_begin_subtest "Do not call notmuch for non-inlinable application/mpeg parts"
584 id='message-with-application/mpeg-attachment@notmuchmail.org'
585 emacs_deliver_message \
586 'Message with application/mpeg attachment' \
589 (insert \"Message-ID: <$id>\n\")
591 (mml-insert-part \"application/mpeg\")
592 (insert \"a fake mp3 file\")"
593 notmuch_counter_reset
594 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
595 (notmuch-show \"id:$id\"))"
596 test_expect_equal $(notmuch_counter_value) 1
598 test_begin_subtest "Do not call notmuch for non-inlinable audio/mpeg parts"
599 id='message-with-audio/mpeg-attachment@notmuchmail.org'
600 emacs_deliver_message \
601 'Message with audio/mpeg attachment' \
604 (insert \"Message-ID: <$id>\n\")
606 (mml-insert-part \"audio/mpeg\")
607 (insert \"a fake mp3 file\")"
608 notmuch_counter_reset
609 test_emacs "(let ((notmuch-command \"$notmuch_counter_command\"))
610 (notmuch-show \"id:$id\"))"
611 test_expect_equal $(notmuch_counter_value) 1
613 test_begin_subtest "notmuch-hello-mode hook is called"
614 counter=$(test_emacs \
615 '(let ((notmuch-hello-mode-hook-counter 0))
616 (kill-buffer "*notmuch-hello*")
618 notmuch-hello-mode-hook-counter)'
620 test_expect_equal "$counter" 1
622 test_begin_subtest "notmuch-hello-mode hook is not called on updates"
623 counter=$(test_emacs \
624 '(let ((notmuch-hello-mode-hook-counter 0))
625 (kill-buffer "*notmuch-hello*")
627 (notmuch-hello-update)
628 notmuch-hello-mode-hook-counter)'
630 test_expect_equal "$counter" 1
632 test_begin_subtest "notmuch-hello-refresh hook is called"
633 counter=$(test_emacs \
634 '(let ((notmuch-hello-refresh-hook-counter 0))
635 (kill-buffer "*notmuch-hello*")
637 notmuch-hello-refresh-hook-counter)'
639 test_expect_equal "$counter" 1
641 test_begin_subtest "notmuch-hello-refresh hook is called on updates"
642 counter=$(test_emacs \
643 '(let ((notmuch-hello-refresh-hook-counter 0))
644 (kill-buffer "*notmuch-hello*")
646 (notmuch-hello-update)
647 notmuch-hello-refresh-hook-counter)'
649 test_expect_equal "$counter" 2