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

From: Junio C Hamano <[email-masked]>
Date: Thu, 04 Dec 2014 12:09:43 -0800

Luis Henriques <[email-masked]> writes:

> Add tests for the --[no-]xmailer option.
>
> Signed-off-by: Luis Henriques <[email-masked]>

Thanks.  Let's squash this in, too.  We care about command line
options taking precedence over configured default.

 t/t9001-send-email.sh | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index bcd5bad..bb573ef 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1406,6 +1406,7 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
 	  2>errors >out &&
 	grep "^!someone@example\.org!$" commandline1
 '
+
 do_xmailer_test() {
 	expected=$1
 	params=$2
@@ -1421,22 +1422,23 @@ do_xmailer_test() {
 	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 '--[no-]xmailer without any configuration' '
+	do_xmailer_test 1 "--xmailer" &&
+	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 '--[no-]xmailer with sendemail.xmailer=true' '
+	test_config sendemail.xmailer true &&
+	do_xmailer_test 1 "" &&
+	do_xmailer_test 0 "--no-xmailer" &&
+	do_xmailer_test 1 "--xmailer"
 '
 
-test_expect_success $PREREQ 'sendemail.xmailer=false supresses X-Mailer header' '
-	git config sendemail.xmailer false &&
-	do_xmailer_test "0" ""
+test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
+	test_config sendemail.xmailer false &&
+	do_xmailer_test 0 "" &&
+	do_xmailer_test 0 "--no-xmailer" &&
+	do_xmailer_test 1 "--xmailer"
 '
 
 test_done