summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-04-13 22:28:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-13 22:28:51 (GMT)
commit2279289e95dc119e79dd0d70c1783c40858e323c (patch)
treefceda8249a83f7517edeb1b3dce86318e8064814 /t
parent4c6ac2da2c1da66a3fba429aa983e481c41fa1d0 (diff)
parentea7811b37e0e6fabb2a410475f198eab33110dcf (diff)
downloadgit-2279289e95dc119e79dd0d70c1783c40858e323c.zip
git-2279289e95dc119e79dd0d70c1783c40858e323c.tar.gz
git-2279289e95dc119e79dd0d70c1783c40858e323c.tar.bz2
Merge branch 'ab/send-email-validate-errors'
Clean-up codepaths that implements "git send-email --validate" option and improves the message from it. * ab/send-email-validate-errors: git-send-email: improve --validate error output git-send-email: refactor duplicate $? checks into a function git-send-email: test full --validate output
Diffstat (limited to 't')
-rwxr-xr-xt/t9001-send-email.sh35
1 files changed, 27 insertions, 8 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 1a1caf8..65b3035 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -415,15 +415,23 @@ test_expect_success $PREREQ 'reject long lines' '
z512=$z64$z64$z64$z64$z64$z64$z64$z64 &&
clean_fake_sendmail &&
cp $patches longline.patch &&
- echo $z512$z512 >>longline.patch &&
+ cat >>longline.patch <<-EOF &&
+ $z512$z512
+ not a long line
+ $z512$z512
+ EOF
test_must_fail git send-email \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
--transfer-encoding=8bit \
$patches longline.patch \
- 2>errors &&
- grep longline.patch errors
+ 2>actual &&
+ cat >expect <<-\EOF &&
+ fatal: longline.patch:35 is longer than 998 characters
+ warning: no patches were sent
+ EOF
+ test_cmp expect actual
'
test_expect_success $PREREQ 'no patch was sent' '
@@ -527,22 +535,33 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
--validate \
- longline.patch 2>err &&
+ longline.patch 2>actual &&
test_path_is_file my-hooks.ran &&
- grep "rejected by sendemail-validate" err
+ cat >expect <<-EOF &&
+ fatal: longline.patch: rejected by sendemail-validate hook
+ fatal: command '"'"'$(pwd)/my-hooks/sendemail-validate'"'"' died with exit code 1
+ warning: no patches were sent
+ EOF
+ test_cmp expect actual
'
test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
- test_config core.hooksPath "$(pwd)/my-hooks" &&
+ hooks_path="$(pwd)/my-hooks" &&
+ test_config core.hooksPath "$hooks_path" &&
test_when_finished "rm my-hooks.ran" &&
test_must_fail git send-email \
--from="Example <nobody@example.com>" \
--to=nobody@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
--validate \
- longline.patch 2>err &&
+ longline.patch 2>actual &&
test_path_is_file my-hooks.ran &&
- grep "rejected by sendemail-validate" err
+ cat >expect <<-EOF &&
+ fatal: longline.patch: rejected by sendemail-validate hook
+ fatal: command '"'"'$hooks_path/sendemail-validate'"'"' died with exit code 1
+ warning: no patches were sent
+ EOF
+ test_cmp expect actual
'
for enc in 7bit 8bit quoted-printable base64