{"thread":{"id":"38112","subject":"[PATCH] test/send-email: --[no-]xmailer tests","startedAt":"2014-12-04T19:11:30Z","lastAt":"2014-12-04T20:09:43Z","messageCount":2,"participants":["Luis Henriques","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"253083","messageId":"20141204190845.GA4906@charon.olymp","threadId":"38112","inReplyTo":null,"subject":"[PATCH] test/send-email: --[no-]xmailer tests","fromName":"Luis Henriques","fromEmail":"henrix@camandro.org","sentAt":"2014-12-04T19:11:30Z","receivedAt":"2014-12-04T19:11:30Z","isPatch":true,"sender":{"key":"henrix@camandro.org","avatar":"https://avatars.githubusercontent.com/u/73643340?v=4"},"body":"Add tests for the --[no-]xmailer option.\n\nSigned-off-by: Luis Henriques <henrix@camandro.org>\n---\n t/t9001-send-email.sh | 32 ++++++++++++++++++++++++++++++++\n 1 file changed, 32 insertions(+)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex e37efef..7a3f996 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1556,5 +1556,37 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '\n \t\t2>errors >out &&\n \tgrep \"^!someone@example\\.org!$\" commandline1\n '\n+do_xmailer_test() {\n+\texpected=$1\n+\tparams=$2\n+\tgit format-patch -1\n+\tgit send-email \\\n+\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t--to=someone@example.com \\\n+\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\t$params \\\n+\t\t0001-*.patch \\\n+\t\t2>errors >out\n+\ttest \"z$(grep ^X-Mailer: out | wc -l)\" = \"z$expected\"\n+\treturn $?\n+}\n+\n+test_expect_success $PREREQ '--xmailer uses X-Mailer header' '\n+\tdo_xmailer_test \"1\" \"--xmailer\"\n+'\n+\n+test_expect_success $PREREQ '--no-xmailer supresses X-Mailer header' '\n+\tdo_xmailer_test \"0\" \"--no-xmailer\"\n+'\n+\n+test_expect_success $PREREQ 'sendemail.xmailer=true uses X-Mailer header' '\n+\tgit config sendemail.xmailer true &&\n+\tdo_xmailer_test \"1\" \"\"\n+'\n+\n+test_expect_success $PREREQ 'sendemail.xmailer=false supresses X-Mailer header' '\n+\tgit config sendemail.xmailer false &&\n+\tdo_xmailer_test \"0\" \"\"\n+'\n \n test_done\n"},{"id":"253088","messageId":"xmqq4mtbtbw8.fsf@gitster.dls.corp.google.com","threadId":"38112","inReplyTo":"20141204190845.GA4906@charon.olymp","subject":"Re: [PATCH] test/send-email: --[no-]xmailer tests","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-04T20:09:43Z","receivedAt":"2014-12-04T20:09:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Luis Henriques <henrix@camandro.org> writes:\n\n> Add tests for the --[no-]xmailer option.\n>\n> Signed-off-by: Luis Henriques <henrix@camandro.org>\n\nThanks.  Let's squash this in, too.  We care about command line\noptions taking precedence over configured default.\n\n t/t9001-send-email.sh | 26 ++++++++++++++------------\n 1 file changed, 14 insertions(+), 12 deletions(-)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex bcd5bad..bb573ef 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1406,6 +1406,7 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '\n \t  2>errors >out &&\n \tgrep \"^!someone@example\\.org!$\" commandline1\n '\n+\n do_xmailer_test() {\n \texpected=$1\n \tparams=$2\n@@ -1421,22 +1422,23 @@ do_xmailer_test() {\n \treturn $?\n }\n \n-test_expect_success $PREREQ '--xmailer uses X-Mailer header' '\n-\tdo_xmailer_test \"1\" \"--xmailer\"\n-'\n-\n-test_expect_success $PREREQ '--no-xmailer supresses X-Mailer header' '\n-\tdo_xmailer_test \"0\" \"--no-xmailer\"\n+test_expect_success $PREREQ '--[no-]xmailer without any configuration' '\n+\tdo_xmailer_test 1 \"--xmailer\" &&\n+\tdo_xmailer_test 0 \"--no-xmailer\"\n '\n \n-test_expect_success $PREREQ 'sendemail.xmailer=true uses X-Mailer header' '\n-\tgit config sendemail.xmailer true &&\n-\tdo_xmailer_test \"1\" \"\"\n+test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=true' '\n+\ttest_config sendemail.xmailer true &&\n+\tdo_xmailer_test 1 \"\" &&\n+\tdo_xmailer_test 0 \"--no-xmailer\" &&\n+\tdo_xmailer_test 1 \"--xmailer\"\n '\n \n-test_expect_success $PREREQ 'sendemail.xmailer=false supresses X-Mailer header' '\n-\tgit config sendemail.xmailer false &&\n-\tdo_xmailer_test \"0\" \"\"\n+test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '\n+\ttest_config sendemail.xmailer false &&\n+\tdo_xmailer_test 0 \"\" &&\n+\tdo_xmailer_test 0 \"--no-xmailer\" &&\n+\tdo_xmailer_test 1 \"--xmailer\"\n '\n \n test_done\n"}]}