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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Apr 6, 2021 at 16:00 UTC
e585210e1bfc5f948bce99596ea9d5e8a6d5cd81
1 file changed
+18
-6
t/t9001-send-email.sh
+18
-6
@@ -422,8 +422,12 @@ test_expect_success $PREREQ 'reject long lines' '
422
--smtp-server="$(pwd)/fake.sendmail" \
423
--transfer-encoding=8bit \
424
$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
431
'
432
433
test_expect_success $PREREQ 'no patch was sent' '
@@ -527,9 +531,13 @@ test_expect_success $PREREQ "--validate respects relative core.hooksPath path" '
531
--to=nobody@example.com \
532
--smtp-server="$(pwd)/fake.sendmail" \
533
--validate \
530
- longline.patch 2>err &&
534
+ longline.patch 2>actual &&
535
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
541
'
542
543
test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
@@ -540,9 +548,13 @@ test_expect_success $PREREQ "--validate respects absolute core.hooksPath path" '
548
--to=nobody@example.com \
549
--smtp-server="$(pwd)/fake.sendmail" \
550
--validate \
543
- longline.patch 2>err &&
551
+ longline.patch 2>actual &&
552
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
558
'
559
560
for enc in 7bit 8bit quoted-printable base64