From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id E10156DE0F44 for ; Wed, 10 Apr 2019 13:25:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.449 X-Spam-Level: X-Spam-Status: No, score=0.449 tagged_above=-999 required=5 tests=[AWL=-0.203, SPF_NEUTRAL=0.652] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aSG8mTwjrJr9 for ; Wed, 10 Apr 2019 13:25:14 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 4AB146DE0F31 for ; Wed, 10 Apr 2019 13:25:13 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 105F31000D0; Wed, 10 Apr 2019 23:25:06 +0300 (EEST) From: Tomi Ollila To: =?utf-8?Q?=C3=96rjan?= Ekeberg , notmuch@notmuchmail.org Subject: Re: [PATCH v3 4/4] test: add test for checking forwarded messages In-Reply-To: <20190410121908.5998-2-ekeberg@kth.se> References: <20190404230126.4283-1-ekeberg@kth.se> <20190410121908.5998-1-ekeberg@kth.se> <20190410121908.5998-2-ekeberg@kth.se> User-Agent: Notmuch/0.28.3+42~g7b16377 (https://notmuchmail.org) Emacs/25.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2019 20:25:16 -0000 On Wed, Apr 10 2019, =C3=96rjan 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=3D"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=3D'OriginalMessage@notmuchmail.org' > +add_message \ > + [id]=3D"$message_id" \ > + '[from]=3D"user@example.com"' \ > + '[subject]=3D"This is the original message"' \ > + '[body]=3D"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 fo= rwarded-tag > + > +test_expect_equal $(notmuch search --output=3Dmessages tag:forwarded) id= :$message_id I'd still do something like: test_expect_equal "$(notmuch search --output=3Dtags id:$message_id)" \ $'forwarded\ninbox\nunread\n'=20 (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 > --=20 > 2.20.1