Skip to content

Commit 879be43

Browse files
avargitster
authored andcommitted
send-email tests: test for boolean variables without a value
The Git.pm code does its own Perl-ifying of boolean variables, let's ensure that empty values = true for boolean variables, as in the C code. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ecc4ee9 commit 879be43

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

t/t9001-send-email.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,6 +1368,16 @@ test_expect_success $PREREQ 'sendemail.identity: bool variable fallback' '
13681368
! grep "X-Mailer" stdout
13691369
'
13701370

1371+
test_expect_success $PREREQ 'sendemail.identity: bool variable without a value' '
1372+
git -c sendemail.xmailer \
1373+
send-email \
1374+
--dry-run \
1375+
--from="[email protected]" \
1376+
$patches >stdout &&
1377+
grep "To: [email protected]" stdout &&
1378+
grep "X-Mailer" stdout
1379+
'
1380+
13711381
test_expect_success $PREREQ '--no-to overrides sendemail.to' '
13721382
git send-email \
13731383
--dry-run \
@@ -2092,13 +2102,32 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=true' '
20922102
do_xmailer_test 1 "--xmailer"
20932103
'
20942104

2105+
test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer' '
2106+
test_when_finished "test_unconfig sendemail.xmailer" &&
2107+
cat >>.git/config <<-\EOF &&
2108+
[sendemail]
2109+
xmailer
2110+
EOF
2111+
test_config sendemail.xmailer true &&
2112+
do_xmailer_test 1 "" &&
2113+
do_xmailer_test 0 "--no-xmailer" &&
2114+
do_xmailer_test 1 "--xmailer"
2115+
'
2116+
20952117
test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
20962118
test_config sendemail.xmailer false &&
20972119
do_xmailer_test 0 "" &&
20982120
do_xmailer_test 0 "--no-xmailer" &&
20992121
do_xmailer_test 1 "--xmailer"
21002122
'
21012123

2124+
test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=' '
2125+
test_config sendemail.xmailer "" &&
2126+
do_xmailer_test 0 "" &&
2127+
do_xmailer_test 0 "--no-xmailer" &&
2128+
do_xmailer_test 1 "--xmailer"
2129+
'
2130+
21022131
test_expect_success $PREREQ 'setup expected-list' '
21032132
git send-email \
21042133
--dry-run \

0 commit comments

Comments
 (0)