By default, emacs hides the User-Agent and References headers when composing mail. This is a good thing for users, but a bad thing for testing, since we can create ugly or invalid headers and not have it show up in the tests.
By setting message-hidden-headers to an empty list, we force emacs to show all the headers, so we can check that they're correct. Users won't see this, but it will let us catch future bugs. As a side-effect, this breaks all the reply tests, since there is a bug with the References and User-Agent headers, fixed in the next commit. --- test/emacs | 55 +++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 43 insertions(+), 12 deletions(-) diff --git a/test/emacs b/test/emacs index 30654bb..15cc778 100755 --- a/test/emacs +++ b/test/emacs @@ -267,17 +267,23 @@ EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "Reply within emacs" -test_emacs '(notmuch-search "subject:\"testing message sent via SMTP\"") +test_subtest_known_broken +test_emacs '(let ((message-hidden-headers ''())) + (notmuch-search "subject:\"testing message sent via SMTP\"") (notmuch-test-wait) (notmuch-search-reply-to-thread) - (test-output)' + (test-output))' sed -i -e 's/^In-Reply-To: <.*>$/In-Reply-To: <XXX>/' OUTPUT +sed -i -e 's/^References: <.*>$/References: <XXX>/' OUTPUT +sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT cat <<EOF >EXPECTED From: Notmuch Test Suite <test_suite at notmuchmail.org> To: user at example.com Subject: Re: Testing message sent via SMTP In-Reply-To: <XXX> Fcc: ${MAIL_DIR}/sent +References: <XXX> +User-Agent: Notmuch/XXX Emacs/XXX --text follows this line-- Notmuch Test Suite <test_suite at notmuchmail.org> writes: @@ -286,19 +292,24 @@ EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "Reply from alternate address within emacs" +test_subtest_known_broken add_message '[from]="Sender <sender at example.com>"' \ [to]=test_suite_other at notmuchmail.org -test_emacs "(notmuch-search \"id:\\\"${gen_msg_id}\\\"\") +test_emacs "(let ((message-hidden-headers '())) + (notmuch-search \"id:\\\"${gen_msg_id}\\\"\") (notmuch-test-wait) (notmuch-search-reply-to-thread) - (test-output)" + (test-output))" +sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT cat <<EOF >EXPECTED From: Notmuch Test Suite <test_suite_other at notmuchmail.org> To: Sender <sender at example.com> Subject: Re: ${test_subtest_name} In-Reply-To: <${gen_msg_id}> Fcc: ${MAIL_DIR}/sent +References: <${gen_msg_id}> +User-Agent: Notmuch/XXX Emacs/XXX --text follows this line-- Sender <sender at example.com> writes: @@ -307,20 +318,25 @@ EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "Reply from address in named group list within emacs" +test_subtest_known_broken add_message '[from]="Sender <sender at example.com>"' \ '[to]=group:test_suite at notmuchmail.org,someone at example.com\;' \ [cc]=test_suite_other at notmuchmail.org -test_emacs "(notmuch-search \"id:\\\"${gen_msg_id}\\\"\") +test_emacs "(let ((message-hidden-headers '())) + (notmuch-search \"id:\\\"${gen_msg_id}\\\"\") (notmuch-test-wait) (notmuch-search-reply-to-thread) - (test-output)" + (test-output))" +sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT cat <<EOF >EXPECTED From: Notmuch Test Suite <test_suite at notmuchmail.org> To: Sender <sender at example.com>, someone at example.com Subject: Re: ${test_subtest_name} In-Reply-To: <${gen_msg_id}> Fcc: ${MAIL_DIR}/sent +References: <${gen_msg_id}> +User-Agent: Notmuch/XXX Emacs/XXX --text follows this line-- Sender <sender at example.com> writes: @@ -329,15 +345,20 @@ EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "Reply within emacs to a multipart/mixed message" -test_emacs '(notmuch-show "id:20091118002059.067214ed at hikari") +test_subtest_known_broken +test_emacs '(let ((message-hidden-headers ''())) + (notmuch-show "id:20091118002059.067214ed at hikari") (notmuch-show-reply) - (test-output)' + (test-output))' +sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT cat <<EOF >EXPECTED From: Notmuch Test Suite <test_suite at notmuchmail.org> To: Adrian Perez de Castro <aperez at igalia.com>, notmuch at notmuchmail.org Subject: Re: [notmuch] Introducing myself In-Reply-To: <20091118002059.067214ed at hikari> Fcc: ${MAIL_DIR}/sent +References: <20091118002059.067214ed at hikari> +User-Agent: Notmuch/XXX Emacs/XXX --text follows this line-- Adrian Perez de Castro <aperez at igalia.com> writes: @@ -388,15 +409,20 @@ EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "Reply within emacs to a multipart/alternative message" -test_emacs '(notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") +test_subtest_known_broken +test_emacs '(let ((message-hidden-headers ''())) + (notmuch-show "id:cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com") (notmuch-show-reply) - (test-output)' + (test-output))' +sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT cat <<EOF >EXPECTED From: Notmuch Test Suite <test_suite at notmuchmail.org> To: Alex Botero-Lowry <alex.boterolowry at gmail.com>, notmuch at notmuchmail.org Subject: Re: [notmuch] preliminary FreeBSD support In-Reply-To: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com> Fcc: ${MAIL_DIR}/sent +References: <cf0c4d610911171136h1713aa59w9cf9aa31f052ad0a at mail.gmail.com> +User-Agent: Notmuch/XXX Emacs/XXX --text follows this line-- Alex Botero-Lowry <alex.boterolowry at gmail.com> writes: @@ -424,19 +450,24 @@ EOF test_expect_equal_file OUTPUT EXPECTED test_begin_subtest "Quote MML tags in reply" +test_subtest_known_broken message_id='test-emacs-mml-quoting at message.id' add_message [id]="$message_id" \ "[subject]='$test_subtest_name'" \ '[body]="<#part disposition=inline>"' -test_emacs "(notmuch-show \"id:$message_id\") +test_emacs "(let ((message-hidden-headers '())) + (notmuch-show \"id:$message_id\") (notmuch-show-reply) - (test-output)" + (test-output))" +sed -i -e 's,^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' OUTPUT cat <<EOF >EXPECTED From: Notmuch Test Suite <test_suite at notmuchmail.org> To: Subject: Re: Quote MML tags in reply In-Reply-To: <test-emacs-mml-quoting at message.id> Fcc: ${MAIL_DIR}/sent +References: <test-emacs-mml-quoting at message.id> +User-Agent: Notmuch/XXX Emacs/XXX --text follows this line-- Notmuch Test Suite <test_suite at notmuchmail.org> writes: -- 1.7.5.4