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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed May 28, 2021 at 11:23 UTC 879be4319f70a2d6c65c3444a269bff671d182cd
1 file changed +29
t/t9001-send-email.sh
+29
@@ -1368,6 +1368,16 @@ test_expect_success $PREREQ 'sendemail.identity: bool variable fallback' '
1368 ! grep "X-Mailer" stdout
1369 '
1370
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="nobody@example.com" \
1376 + $patches >stdout &&
1377 + grep "To: default@example.com" stdout &&
1378 + grep "X-Mailer" stdout
1379 +'
1380 +
1381 test_expect_success $PREREQ '--no-to overrides sendemail.to' '
1382 git send-email \
1383 --dry-run \
@@ -2092,6 +2102,18 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=true' '
2102 do_xmailer_test 1 "--xmailer"
2103 '
2104
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 +
2117 test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
2118 test_config sendemail.xmailer false &&
2119 do_xmailer_test 0 "" &&
@@ -2099,6 +2121,13 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
2121 do_xmailer_test 1 "--xmailer"
2122 '
2123
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 +
2131 test_expect_success $PREREQ 'setup expected-list' '
2132 git send-email \
2133 --dry-run \