unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Tomi Ollila <tomi.ollila@iki.fi>
To: "Örjan Ekeberg" <ekeberg@kth.se>, notmuch@notmuchmail.org
Subject: Re: [PATCH v3 4/4] test: add test for checking forwarded messages
Date: Wed, 10 Apr 2019 23:25:05 +0300	[thread overview]
Message-ID: <m2mukxr4ke.fsf@guru.guru-group.fi> (raw)
In-Reply-To: <20190410121908.5998-2-ekeberg@kth.se>

On Wed, Apr 10 2019, Ö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.

good stuff -- comments inline

> ---
>  test/T730-emacs-forwarding.sh | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 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..d1a573fb
> --- /dev/null
> +++ b/test/T730-emacs-forwarding.sh
> @@ -0,0 +1,30 @@
> +#!/usr/bin/env bash
> +
> +test_description="emacs forwarding"
> +. $(dirname "$0")/test-lib.sh || exit 1
> +
> +test_begin_subtest "Forward setting the correct references header"
> +# Check that, when forwarding a message, the new message has
> +# a References-header pointing to the original (forwarded) message.
> +
> +message_id='OriginalMessage@notmuchmail.org'
> +add_message \
> +    [id]="$message_id" \
> +    '[from]="user@example.com"' \
> +    '[subject]="This is the original message"' \
> +    '[body]="Dummy text."'
> +
> +test_emacs_expect_t "
> +   (progn
> +    (notmuch-show \"id:$message_id\")
> +    (notmuch-show-forward-message)
> +    (run-hooks 'notmuch-mua-send-hook)

Would instead (run-hooks...) in the above, embedding:

    (let ((message-send-mail-function (lambda () t))
          (mail-host-address \"example.com\"))
and
     (notmuch-mua-send)

work (that is what we do in emacs_fcc_message () in test-lib.sh

?

> +    (notmuch-test-expect-equal (message-field-value \"References\")
> +                               \"<$message_id>\"))"

You probably had tabs and spaces "correct" last time, but I got confused by
the extra line and forgot to drop indentation to see better. To be
consistent with other rests these lines do need to have tabs (width 8) and
rest spaces

> +
> +test_begin_subtest "Forwarding adding the forwarded tag"
> +# Check that the send hook called in the previous subtest did add the forwarded-tag
> +
> +test_expect_equal $(notmuch search --output=messages tag:forwarded) id:$message_id

I'd still do something like:

 test_expect_equal "$(notmuch search --output=tags id:$message_id)" \
 	$'forwarded\ninbox\nunread\n' 

(note: quoting aroung first arg and $'dollar-single' in second, but did not
test that this is what exactly works (newlines could be clearer, though) :)

... to ensure (and show visibility) that just "forwarded" were added. if
anyone(tm) ever changes system so that default tags change, many other
tests also need updating...

> +
> +test_done
> -- 
> 2.20.1

  reply	other threads:[~2019-04-10 20:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30 21:48 [PATCH 0/2] Updating tags when replying or forwarding via a buffer-local variable Örjan Ekeberg
2019-03-30 21:48 ` [PATCH 1/2] emacs: Use a buffer-local variable to update tags when sending replies Örjan Ekeberg
2019-03-30 21:48 ` [PATCH 2/2] emacs: Tag forwarded messages with +forwarded (customizable) Örjan Ekeberg
2019-03-31 22:34 ` [PATCH 0/2] Updating tags when replying or forwarding via a buffer-local variable Daniel Kahn Gillmor
2019-04-01 21:24 ` Tomi Ollila
2019-04-02  9:12   ` Örjan Ekeberg
2019-04-03 20:10     ` Tomi Ollila
2019-04-04 23:01       ` Örjan Ekeberg
2019-04-04 23:01         ` [PATCH v2 1/4] emacs: Add References header to forwarded messages Örjan Ekeberg
2019-04-04 23:01         ` [PATCH v2 2/4] emacs: Use a buffer-local variable to update tags when sending replies Örjan Ekeberg
2019-04-04 23:01         ` [PATCH v2 3/4] emacs: Tag forwarded messages with +forwarded (customizable) Örjan Ekeberg
2019-04-04 23:01         ` [PATCH v2 4/4] test: add test for checking forwarded messages Örjan Ekeberg
2019-04-07 19:39           ` Tomi Ollila
2019-04-07 20:24             ` Örjan Ekeberg
2019-04-08 14:21           ` David Edmondson
2019-04-10 12:19             ` Updated testing script Örjan Ekeberg
2019-04-10 12:19               ` [PATCH v3 4/4] test: add test for checking forwarded messages Örjan Ekeberg
2019-04-10 20:25                 ` Tomi Ollila [this message]
2019-04-11 11:26                   ` Örjan Ekeberg
2019-04-12 12:01         ` Updated version of the patch-set for tagging " Örjan Ekeberg
2019-04-12 12:01           ` [PATCH v4 1/4] emacs: Add References header to " Örjan Ekeberg
2019-04-12 12:01           ` [PATCH v4 2/4] emacs: Use a buffer-local variable to update tags when sending replies Örjan Ekeberg
2019-04-12 12:01           ` [PATCH v4 3/4] emacs: Tag forwarded messages with +forwarded (customizable) Örjan Ekeberg
2019-04-12 12:01           ` [PATCH v4 4/4] test: add test for checking forwarded messages Örjan Ekeberg
2019-04-13 10:19           ` Updated version of the patch-set for tagging " Tomi Ollila
2019-04-14 11:30           ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2mukxr4ke.fsf@guru.guru-group.fi \
    --to=tomi.ollila@iki.fi \
    --cc=ekeberg@kth.se \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).