git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] test/send-email: --[no-]xmailer tests

From
Luis Henriques <henrix@camandro.org>
Date
Dec 4, 2014, 19:11 UTC
Message-ID
<20141204190845.GA4906@charon.olymp>
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: Junio C Hamano
Message 1 of 2 in “test/send-email: --[no-]xmailer tests”
  1. test/send-email: --[no-]xmailer testsLuis Henriques, Dec 4, 2014
  2. Junio C HamanoDec 4, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.