[PATCH v2 4/4] test: add test for checking forwarded messages

David Edmondson dme at dme.org
Mon Apr 8 07:21:53 PDT 2019


On Friday, 2019-04-05 at 01:01:26 +02, Örjan Ekeberg wrote:

> Add test of forwarding messages from within emacs.
> The first test checks that a references header is properly
> added to the new message.  The second test checks that the
> send-hook of the forwarding message adds a forwarded-tag
> to the original message.
> ---
>  test/T730-emacs-forwarding.sh | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>  create mode 100755 test/T730-emacs-forwarding.sh
>
> diff --git a/test/T730-emacs-forwarding.sh b/test/T730-emacs-forwarding.sh
> new file mode 100755
> index 00000000..0bdd197f
> --- /dev/null
> +++ b/test/T730-emacs-forwarding.sh
> @@ -0,0 +1,35 @@
> +#!/usr/bin/env bash
> +
> +test_description="emacs forwarding"
> +. $(dirname "$0")/test-lib.sh || exit 1
> +
> +test_begin_subtest "Forward setting the correct references header"
> +message_id='OriginalMessage at notmuchmail.org'
> +add_message \
> +    [id]="$message_id" \
> +    '[from]="user at example.com"' \
> +    '[subject]="This is the original message"' \
> +    '[body]="-----Original Message-----
> +Text here."'
> +
> +test_emacs "(let ((message-hidden-headers ())
> +	          (notmuch-fcc-dirs ()))

This is non-idiomatic. We would normally write:

(let (message-hidden-headers notmuch-fcc-dirs)
 ...)

That is, they are bound to nil by default.
 
> +	     (notmuch-show \"id:$message_id\")
> +	     (notmuch-show-forward-message)
> +             (run-hooks 'notmuch-mua-send-hook)
> +	     (message-narrow-to-headers)
> +	     (test-visible-output))
> +            (run-hooks 'notmuch-mua-send-hook)"
> +
> +cat <<EOF >EXPECTED
> +From: Notmuch Test Suite <test_suite at notmuchmail.org>
> +To: 
> +Subject: [user at example.com] This is the original message
> +References: <$message_id>
> +EOF
> +test_expect_equal_file EXPECTED OUTPUT
> +
> +test_begin_subtest "Forwarding adding the forwarded tag"
> +test_expect_equal $(notmuch search --output=messages tag:forwarded) id:$message_id
> +
> +test_done
> -- 
> 2.20.1
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
-- 
You can't hide from the flipside.


More information about the notmuch mailing list