From: Luis Henriques <henrix@camandro.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Eric Wong <normalperson@yhbt.net>, git@vger.kernel.org
Subject: [PATCH] test/send-email: --[no-]xmailer tests
Date: Thu, 4 Dec 2014 19:11:30 +0000 [thread overview]
Message-ID: <20141204190845.GA4906@charon.olymp> (raw)
Add tests for the --[no-]xmailer option.
Signed-off-by: Luis Henriques <henrix@camandro.org>
---
t/t9001-send-email.sh | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e37efef..7a3f996 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1556,5 +1556,37 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
2>errors >out &&
grep "^!someone@example\.org!$" commandline1
'
+do_xmailer_test() {
+ expected=$1
+ params=$2
+ git format-patch -1
+ git send-email \
+ --from="Example <nobody@example.com>" \
+ --to=someone@example.com \
+ --smtp-server="$(pwd)/fake.sendmail" \
+ $params \
+ 0001-*.patch \
+ 2>errors >out
+ test "z$(grep ^X-Mailer: out | wc -l)" = "z$expected"
+ return $?
+}
+
+test_expect_success $PREREQ '--xmailer uses X-Mailer header' '
+ do_xmailer_test "1" "--xmailer"
+'
+
+test_expect_success $PREREQ '--no-xmailer supresses X-Mailer header' '
+ do_xmailer_test "0" "--no-xmailer"
+'
+
+test_expect_success $PREREQ 'sendemail.xmailer=true uses X-Mailer header' '
+ git config sendemail.xmailer true &&
+ do_xmailer_test "1" ""
+'
+
+test_expect_success $PREREQ 'sendemail.xmailer=false supresses X-Mailer header' '
+ git config sendemail.xmailer false &&
+ do_xmailer_test "0" ""
+'
test_done
next reply other threads:[~2014-12-04 19:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-04 19:11 Luis Henriques [this message]
2014-12-04 20:09 ` [PATCH] test/send-email: --[no-]xmailer tests Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141204190845.GA4906@charon.olymp \
--to=henrix@camandro.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=normalperson@yhbt.net \
/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.
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 NNTP newsgroup(s).