git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] test/send-email: --[no-]xmailer tests
@ 2014-12-04 19:11 Luis Henriques
  2014-12-04 20:09 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Luis Henriques @ 2014-12-04 19:11 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Eric Wong, git

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-12-04 20:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04 19:11 [PATCH] test/send-email: --[no-]xmailer tests Luis Henriques
2014-12-04 20:09 ` Junio C Hamano

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).