Re: [PATCH v2 4/4] test: add test for checking forwarded messages
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 ..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='originalmess...@notmuchmail.org' > +add_message \ > +[id]="$message_id" \ > +'[from]="u...@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+From: Notmuch Test Suite > +To: > +Subject: [u...@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@notmuchmail.org > https://notmuchmail.org/mailman/listinfo/notmuch dme. -- You can't hide from the flipside. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2 4/4] test: add test for checking forwarded messages
Tomi Ollila writes: > On Fri, Apr 05 2019, Örjan Ekeberg wrote: > >> +test_begin_subtest "Forward setting the correct references header" >> +message_id='originalmess...@notmuchmail.org' >> +add_message \ >> +[id]="$message_id" \ >> +'[from]="u...@example.com"' \ >> +'[subject]="This is the original message"' \ >> +'[body]="-Original Message- >> +Text here."' >> + >> +test_emacs "(let ((message-hidden-headers ()) >> + (notmuch-fcc-dirs ())) >> + (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)" > > Cannot fully understand the above (or, actually not much of it), perhaps > someone else(tm). Short walkthrough: - create a small message in the database (add_message) - set message-hidden-headers to nil so that we can verify them - set notmuch-fcc-dirs to nil to avoid including the fcc-header - get the message we just created (notmuch-show) - create a forwarding message (forwarding the current one) - compare the headers to the expected output - run the send hooks to emulate sending The double run-hooks lines is an error; only the second one is needed. > anyway, it looks like tabs and 8-spaces are used for indenting. Yes. This seems to be common in the emacs code for notmuch, so I did not untabify. > then, instead of only checking forwarded tag was added, checking > checking all tags should be done, so that there is nothing extra > (that check twice, first after add_message, and then at the end) The test was only supposed to check that the forwarded tag was properly added when forwarding. If other tags are added elsewhere in future code, this is not really an error and should not be flagged by the test, should it? > Tomi Thanks for your feedback. /Örjan ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2 4/4] test: add test for checking forwarded messages
On Fri, Apr 05 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. > --- > 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 ..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='originalmess...@notmuchmail.org' > +add_message \ > +[id]="$message_id" \ > +'[from]="u...@example.com"' \ > +'[subject]="This is the original message"' \ > +'[body]="-Original Message- > +Text here."' > + > +test_emacs "(let ((message-hidden-headers ()) > + (notmuch-fcc-dirs ())) > + (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)" Cannot fully understand the above (or, actually not much of it), perhaps someone else(tm). anyway, it looks like tabs and 8-spaces are used for indenting. then, instead of only checking forwarded tag was added, checking checking all tags should be done, so that there is nothing extra (that check twice, first after add_message, and then at the end) Tomi > + > +cat+From: Notmuch Test Suite > +To: > +Subject: [u...@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@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH v2 4/4] test: add test for checking forwarded messages
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 ..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='originalmess...@notmuchmail.org' +add_message \ +[id]="$message_id" \ +'[from]="u...@example.com"' \ +'[subject]="This is the original message"' \ +'[body]="-Original Message- +Text here."' + +test_emacs "(let ((message-hidden-headers ()) + (notmuch-fcc-dirs ())) +(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 +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@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch