]> git.notmuchmail.org Git - notmuch/blobdiff - test/T310-emacs.sh
lib/database: delete stemmer on destroy
[notmuch] / test / T310-emacs.sh
index b94236fdde1dcdbdddcf7dc7079a7dd339bb8af0..a05b828ae9f759f31c12a41c015cc77224d8a4ea 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description="emacs interface"
 . $(dirname "$0")/test-lib.sh || exit 1
-. $(dirname "$0")/test-lib-emacs.sh || exit 1
+. $NOTMUCH_SRCDIR/test/test-lib-emacs.sh || exit 1
 
 EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output
 
@@ -41,6 +41,20 @@ test_emacs '(notmuch-search "tag:inbox")
            (test-output)'
 test_expect_equal_file $EXPECTED/notmuch-search-tag-inbox OUTPUT
 
+test_begin_subtest "Functions in search-result-format"
+test_emacs '(let
+               ((notmuch-search-result-format
+                 (quote ((notmuch-test-result-flags . "%s ")
+                         ("date" . "%12s ")
+                         ("count" . "%9s ")
+                         ("authors" . "%-30s ")
+                         ("subject" . "%s ")
+                         ("tags" . "(%s)")))))
+             (notmuch-search "tag:inbox")
+             (notmuch-test-wait)
+             (test-output))'
+test_expect_equal_file $EXPECTED/search-result-format-function OUTPUT
+
 test_begin_subtest "Incremental parsing of search results"
 test_emacs "(cl-letf* (((symbol-function 'orig)
                        (symbol-function 'notmuch-search-process-filter))
@@ -471,6 +485,31 @@ Sender <sender@example.com> writes:
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "Reply with show.extra_headers set"
+notmuch config set show.extra_headers Received
+add_message '[from]="Sender <sender@example.com>"' \
+            [to]=test_suite_other@notmuchmail.org
+
+test_emacs "(let ((message-hidden-headers '()))
+           (notmuch-search \"id:\\\"${gen_msg_id}\\\"\")
+           (notmuch-test-wait)
+           (notmuch-search-reply-to-thread)
+           (test-output))"
+cat <<EOF >EXPECTED
+From: Notmuch Test Suite <test_suite_other@notmuchmail.org>
+To: Sender <sender@example.com>
+Subject: Re: ${test_subtest_name}
+In-Reply-To: <${gen_msg_id}>
+Fcc: ${MAIL_DIR}/sent
+References: <${gen_msg_id}>
+--text follows this line--
+Sender <sender@example.com> writes:
+
+> This is just a test message (#${gen_msg_cnt})
+EOF
+notmuch config set show.extra_headers
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest "Reply from address in named group list within emacs"
 add_message '[from]="Sender <sender@example.com>"' \
             '[to]=group:test_suite@notmuchmail.org,someone@example.com\;' \
@@ -666,7 +705,7 @@ References: <XXX>
 --text follows this line--
 test_suite@notmuchmail.org writes:
 
-> This is just a test message (#7)
+> This is just a test message (#${gen_msg_cnt})
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
@@ -869,7 +908,7 @@ test_emacs '(notmuch-show "id:\"bought\"")
        (notmuch-show-stash-message-id-stripped)
        (notmuch-show-stash-tags)
        (notmuch-show-stash-filename)
-       (notmuch-show-stash-mlarchive-link "Gmane")
+       (notmuch-show-stash-mlarchive-link "Notmuch")
        (notmuch-show-stash-mlarchive-link "MARC")
        (notmuch-show-stash-mlarchive-link "Mail Archive, The")
        (switch-to-buffer
@@ -890,7 +929,7 @@ id:bought
 bought
 inbox,stashtest
 ${gen_msg_filename}
-https://mid.gmane.org/bought
+https://nmbug.notmuchmail.org/nmweb/show/bought
 https://marc.info/?i=bought
 https://mid.mail-archive.com/bought
 EOF
@@ -1060,7 +1099,7 @@ End of search results.
 YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details)
 === ERROR ===
 YYY/notmuch_fail exited with status 1
-command: YYY/notmuch_fail search --format\=sexp --format-version\=4 --sort\=newest-first tag\:inbox
+command: YYY/notmuch_fail search --format\=sexp --format-version\=5 --sort\=newest-first tag\:inbox
 exit status: 1"
 
 test_begin_subtest "Search handles subprocess warnings"
@@ -1154,4 +1193,10 @@ This text added by the hook.
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest "notmuch-search with nonexistent CWD"
+test_emacs '(test-log-error
+             (let ((default-directory "/nonexistent"))
+               (notmuch-search "*")))'
+test_expect_equal "$(cat MESSAGES)" "COMPLETE"
+
 test_done