Skip to content

Commit e585210

Browse files
avargitster
authored andcommitted
git-send-email: test full --validate output
Change the tests that grep substrings out of the output to use a full test_cmp, in preparation for improving the output. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b362acf commit e585210

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

t/t9001-send-email.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,12 @@ test_expect_success $PREREQ 'reject long lines' '
422422
--smtp-server="$(pwd)/fake.sendmail" \
423423
--transfer-encoding=8bit \
424424
$patches longline.patch \
425-
2>errors &&
426-
grep longline.patch errors
425+
2>actual &&
426+
cat >expect <<-\EOF &&
427+
fatal: longline.patch: 35: patch contains a line longer than 998 characters
428+
warning: no patches were sent
429+
EOF
430+
test_cmp expect actual
427431
'
428432

429433
test_expect_success $PREREQ 'no patch was sent' '
@@ -527,9 +531,13 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
527531
528532
--smtp-server="$(pwd)/fake.sendmail" \
529533
--validate \
530-
longline.patch 2>err &&
534+
longline.patch 2>actual &&
531535
test_path_is_file my-hooks.ran &&
532-
grep "rejected by sendemail-validate" err
536+
cat >expect <<-\EOF &&
537+
fatal: longline.patch: rejected by sendemail-validate hook
538+
warning: no patches were sent
539+
EOF
540+
test_cmp expect actual
533541
'
534542

535543
test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
@@ -540,9 +548,13 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
540548
541549
--smtp-server="$(pwd)/fake.sendmail" \
542550
--validate \
543-
longline.patch 2>err &&
551+
longline.patch 2>actual &&
544552
test_path_is_file my-hooks.ran &&
545-
grep "rejected by sendemail-validate" err
553+
cat >expect <<-\EOF &&
554+
fatal: longline.patch: rejected by sendemail-validate hook
555+
warning: no patches were sent
556+
EOF
557+
test_cmp expect actual
546558
'
547559

548560
for enc in 7bit 8bit quoted-printable base64

0 commit comments

Comments
 (0)