Skip to content

Commit 2cf770f

Browse files
lumigchgitster
authored andcommitted
test/send-email: --[no-]xmailer tests
Add tests for the --[no-]xmailer option. Signed-off-by: Luis Henriques <henrix@camandro.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ac1596a commit 2cf770f

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

t/t9001-send-email.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,4 +1407,37 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
14071407
grep "^!someone@example\.org!$" commandline1
14081408
'
14091409

1410+
do_xmailer_test () {
1411+
expected=$1 params=$2 &&
1412+
git format-patch -1 &&
1413+
git send-email \
1414+
--from="Example <nobody@example.com>" \
1415+
--to=someone@example.com \
1416+
--smtp-server="$(pwd)/fake.sendmail" \
1417+
$params \
1418+
0001-*.patch \
1419+
2>errors >out &&
1420+
{ grep '^X-Mailer:' out || :; } >mailer &&
1421+
test_line_count = $expected mailer
1422+
}
1423+
1424+
test_expect_success $PREREQ '--[no-]xmailer without any configuration' '
1425+
do_xmailer_test 1 "--xmailer" &&
1426+
do_xmailer_test 0 "--no-xmailer"
1427+
'
1428+
1429+
test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=true' '
1430+
test_config sendemail.xmailer true &&
1431+
do_xmailer_test 1 "" &&
1432+
do_xmailer_test 0 "--no-xmailer" &&
1433+
do_xmailer_test 1 "--xmailer"
1434+
'
1435+
1436+
test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
1437+
test_config sendemail.xmailer false &&
1438+
do_xmailer_test 0 "" &&
1439+
do_xmailer_test 0 "--no-xmailer" &&
1440+
do_xmailer_test 1 "--xmailer"
1441+
'
1442+
14101443
test_done

0 commit comments

Comments
 (0)