Re: [PATCH] test: canonicalize content-type in "Sending a message via (fake) SMTP"

Subject: Re: [PATCH] test: canonicalize content-type in "Sending a message via (fake) SMTP"

Date: Wed, 29 Aug 2012 21:36:53 -0400

To: david@tethera.net

Cc: notmuch@notmuchmail.org, David Bremner

From: Austin Clements


Quoth david@tethera.net on Aug 29 at 10:12 pm:
> From: David Bremner <bremner@debian.org>
> 
> The version of message.el in emacs24 omits the charset=us-ascii,
> causing the current version of this test to fail. Here we just ask
> that the content-type start with "text/plain"
> ---
> 
> Alternatively, somebody might want to dig into message.el and
> understand why it behaves differently in emacs24. I could not
> replicate the omission of charset=us-ascii sending a message
> interactively.
> 
>  test/emacs |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/test/emacs b/test/emacs
> index afe35ba..6fab4db 100755
> --- a/test/emacs
> +++ b/test/emacs
> @@ -169,7 +169,8 @@ emacs_deliver_message \
>       (insert "To: user@example.com\n")'
>  sed \
>      -e s',^User-Agent: Notmuch/.* Emacs/.*,User-Agent: Notmuch/XXX Emacs/XXX,' \
> -    -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' < sent_message >OUTPUT
> +    -e s',^Message-ID: <.*>$,Message-ID: <XXX>,' \
> +    -e s',^Content-Type: text/plain.*$,Content-Type: XXX,' < sent_message >OUTPUT

Maybe something more exact?  Since us-ascii is the default charset and
equivalent to not specifying a charset (which is presumably related to
the change in Emacs 24), how about
  s',^\(Content-Type: text/plain\); charset=us-ascii\b,\1,'
?  That would canonicalize away only the default-valued part.

>  cat <<EOF >EXPECTED
>  From: Notmuch Test Suite <test_suite@notmuchmail.org>
>  To: user@example.com
> @@ -178,7 +179,7 @@ Date: 01 Jan 2000 12:00:00 -0000
>  User-Agent: Notmuch/XXX Emacs/XXX
>  Message-ID: <XXX>
>  MIME-Version: 1.0
> -Content-Type: text/plain; charset=us-ascii
> +Content-Type: XXX
>  
>  This is a test that messages are sent via SMTP
>  EOF

Thread: