X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2FT310-emacs.sh;h=5f74305dd3ef912f8fd49dfb7b87086eee0acd26;hp=c8a25de2263498cc2fffb768c3f4ae596f57fc30;hb=cd8006886b1c80ff556a96f1e84e3d3914067a54;hpb=71f04b9a67332782cd021cfe9923fc046c29c3ad diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index c8a25de2..5f74305d 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash test_description="emacs interface" -. ./test-lib.sh || exit 1 +. $(dirname "$0")/test-lib.sh || exit 1 -EXPECTED=$TEST_DIRECTORY/emacs.expected-output +EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output add_email_corpus # syntax errors in test-lib.el cause mysterious failures test_begin_subtest "Syntax of emacs test library" -test_expect_success "${TEST_EMACS} -Q --batch --load $TEST_DIRECTORY/test-lib.el" +test_expect_success "${TEST_EMACS} -Q --batch --load $NOTMUCH_SRCDIR/test/test-lib.el" test_begin_subtest "Basic notmuch-hello view in emacs" test_emacs '(notmuch-hello) @@ -86,14 +86,13 @@ test_emacs "(let ((notmuch-show-indent-messages-width 4)) test_expect_equal_file $EXPECTED/notmuch-show-thread-maildir-storage-with-fourfold-indentation OUTPUT test_begin_subtest "notmuch-show for message with invalid From" -test_subtest_broken_gmime_3 add_message "[subject]=\"message-with-invalid-from\"" \ "[from]=\"\\\"Invalid \\\" From\\\" \"" thread=$(notmuch search --output=threads subject:message-with-invalid-from) test_emacs "(notmuch-show \"$thread\") (test-output \"OUTPUT.raw\")" cat <EXPECTED -"Invalid " (2001-01-05) (inbox) +Invalid " From (2001-01-05) (inbox) Subject: message-with-invalid-from To: Notmuch Test Suite Date: GENERATED_DATE @@ -401,6 +400,28 @@ Notmuch Test Suite writes: EOF test_expect_equal_file EXPECTED OUTPUT +test_begin_subtest "Reply within emacs to a message with TAB in subject" +test_emacs '(let ((message-hidden-headers ''())) + (notmuch-search "id:1258471718-6781-1-git-send-email-dottedmag@dottedmag.net") + (notmuch-test-wait) + (notmuch-search-show-thread) + (notmuch-test-wait) + (notmuch-show-reply-sender) + (test-output))' +sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: /' OUTPUT +sed -i -e 's/^References: <.*>$/References: /' OUTPUT +sed -i -e '/^--text follows this line--$/q' OUTPUT +cat <EXPECTED +From: Notmuch Test Suite +To: Mikhail Gusarov +Subject: Re: [notmuch] [PATCH 1/2] Close message file after parsing message headers +In-Reply-To: +Fcc: ${MAIL_DIR}/sent +References: +--text follows this line-- +EOF +test_expect_equal_file EXPECTED OUTPUT + test_begin_subtest "Reply from alternate address within emacs" add_message '[from]="Sender "' \ [to]=test_suite_other@notmuchmail.org @@ -588,7 +609,7 @@ test_emacs "(let ((message-hidden-headers '())) (test-output))" cat <EXPECTED From: Notmuch Test Suite -To: +To: test_suite@notmuchmail.org Subject: Re: Reply within emacs to an html-only message In-Reply-To: <${gen_msg_id}> Fcc: ${MAIL_DIR}/sent @@ -601,7 +622,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "Reply within emacs to message from self" -test_subtest_known_broken add_message '[from]="test_suite@notmuchmail.org"' \ '[to]="test_suite@notmuchmail.org"' test_emacs "(let ((message-hidden-headers '())) @@ -635,7 +655,7 @@ test_emacs "(let ((message-hidden-headers '())) (test-output))" cat <EXPECTED From: Notmuch Test Suite -To: +To: test_suite@notmuchmail.org Subject: Re: Quote MML tags in reply In-Reply-To: Fcc: ${MAIL_DIR}/sent @@ -844,7 +864,7 @@ id:bought bought inbox,stashtest ${gen_msg_filename} -http://mid.gmane.org/bought +https://mid.gmane.org/bought https://marc.info/?i=bought https://mid.mail-archive.com/bought EOF @@ -1015,7 +1035,7 @@ YYY/notmuch_fail exited with status 1 (see *Notmuch errors* for more details) === ERROR === [XXX] YYY/notmuch_fail exited with status 1 -command: YYY/notmuch_fail search --format\=sexp --format-version\=3 --sort\=newest-first tag\:inbox +command: YYY/notmuch_fail search --format\=sexp --format-version\=4 --sort\=newest-first tag\:inbox exit status: 1" test_begin_subtest "Search handles subprocess warnings" @@ -1084,4 +1104,29 @@ output=$(test_emacs "(mapcar 'notmuch-escape-boolean-term (list \"\\x201cxyz\\x201d\"))") test_expect_equal "$output" '("\"\"" "abc`~!@#$%^&*-=_+123" "\"(abc\"" "\")abc\"" "\"\"\"abc\"" "\"'$'\x01''xyz\"" "\"“xyz”\"")' +test_begin_subtest "Sending a message calls the send message hooks" +emacs_deliver_message \ + 'Testing message sending hooks' \ + 'This is a test of the message sending hooks.' \ + "(message-goto-to) + (kill-whole-line) + (insert \"To: user@example.com\n\") + (add-hook 'notmuch-mua-send-hook (lambda () (goto-char (point-max)) (insert \"\nThis text added by the hook.\")))" +sed \ + -e s',^Message-ID: <.*>$,Message-ID: ,' \ + -e s',^\(Content-Type: text/plain\); charset=us-ascii$,\1,' < sent_message >OUTPUT +cat <EXPECTED +From: Notmuch Test Suite +To: user@example.com +Subject: Testing message sending hooks +Date: 01 Jan 2000 12:00:00 -0000 +Message-ID: +MIME-Version: 1.0 +Content-Type: text/plain + +This is a test of the message sending hooks. +This text added by the hook. +EOF +test_expect_equal_file EXPECTED OUTPUT + test_done