Skip to content

Commit f6df5e2

Browse files
committed
Merge branch 'jc/t3206-test-when-finished-fix'
Test clean-up. * jc/t3206-test-when-finished-fix: t3206: test_when_finished before dirtying operations, not after
2 parents 402f36f + 6caa96c commit f6df5e2

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

t/t3206-range-diff.sh

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -534,9 +534,9 @@ test_expect_success 'dual-coloring' '
534534
for prev in topic main..topic
535535
do
536536
test_expect_success "format-patch --range-diff=$prev" '
537+
test_when_finished "rm -f 000?-*" &&
537538
git format-patch --cover-letter --range-diff=$prev \
538539
main..unmodified >actual &&
539-
test_when_finished "rm 000?-*" &&
540540
test_line_count = 5 actual &&
541541
test_grep "^Range-diff:$" 0000-* &&
542542
grep "= 1: .* s/5/A" 0000-* &&
@@ -561,32 +561,32 @@ test_expect_success "explicit --no-cover-letter defeats implied --cover-letter"
561561
'
562562

563563
test_expect_success 'format-patch --range-diff as commentary' '
564+
test_when_finished "rm -f 0001-*" &&
564565
git format-patch --range-diff=HEAD~1 HEAD~1 >actual &&
565-
test_when_finished "rm 0001-*" &&
566566
test_line_count = 1 actual &&
567567
test_grep "^Range-diff:$" 0001-* &&
568568
grep "> 1: .* new message" 0001-*
569569
'
570570

571571
test_expect_success 'format-patch --range-diff reroll-count with a non-integer' '
572+
test_when_finished "rm -f v2.9-0001-*" &&
572573
git format-patch --range-diff=HEAD~1 -v2.9 HEAD~1 >actual &&
573-
test_when_finished "rm v2.9-0001-*" &&
574574
test_line_count = 1 actual &&
575575
test_grep "^Range-diff:$" v2.9-0001-* &&
576576
grep "> 1: .* new message" v2.9-0001-*
577577
'
578578

579579
test_expect_success 'format-patch --range-diff reroll-count with a integer' '
580+
test_when_finished "rm -f v2-0001-*" &&
580581
git format-patch --range-diff=HEAD~1 -v2 HEAD~1 >actual &&
581-
test_when_finished "rm v2-0001-*" &&
582582
test_line_count = 1 actual &&
583583
test_grep "^Range-diff ..* v1:$" v2-0001-* &&
584584
grep "> 1: .* new message" v2-0001-*
585585
'
586586

587587
test_expect_success 'format-patch --range-diff with v0' '
588+
test_when_finished "rm -f v0-0001-*" &&
588589
git format-patch --range-diff=HEAD~1 -v0 HEAD~1 >actual &&
589-
test_when_finished "rm v0-0001-*" &&
590590
test_line_count = 1 actual &&
591591
test_grep "^Range-diff:$" v0-0001-* &&
592592
grep "> 1: .* new message" v0-0001-*
@@ -607,9 +607,9 @@ test_expect_success 'basic with modified format.pretty without "commit "' '
607607
'
608608

609609
test_expect_success 'range-diff compares notes by default' '
610+
test_when_finished "git notes remove topic unmodified || :" &&
610611
git notes add -m "topic note" topic &&
611612
git notes add -m "unmodified note" unmodified &&
612-
test_when_finished git notes remove topic unmodified &&
613613
git range-diff --no-color main..topic main..unmodified \
614614
>actual &&
615615
sed s/Z/\ /g >expect <<-EOF &&
@@ -631,9 +631,9 @@ test_expect_success 'range-diff compares notes by default' '
631631
'
632632

633633
test_expect_success 'range-diff with --no-notes' '
634+
test_when_finished "git notes remove topic unmodified || :" &&
634635
git notes add -m "topic note" topic &&
635636
git notes add -m "unmodified note" unmodified &&
636-
test_when_finished git notes remove topic unmodified &&
637637
git range-diff --no-color --no-notes main..topic main..unmodified \
638638
>actual &&
639639
cat >expect <<-EOF &&
@@ -646,12 +646,12 @@ test_expect_success 'range-diff with --no-notes' '
646646
'
647647

648648
test_expect_success 'range-diff with multiple --notes' '
649+
test_when_finished "git notes --ref=note1 remove topic unmodified || :" &&
649650
git notes --ref=note1 add -m "topic note1" topic &&
650651
git notes --ref=note1 add -m "unmodified note1" unmodified &&
651-
test_when_finished git notes --ref=note1 remove topic unmodified &&
652+
test_when_finished "git notes --ref=note2 remove topic unmodified || :" &&
652653
git notes --ref=note2 add -m "topic note2" topic &&
653654
git notes --ref=note2 add -m "unmodified note2" unmodified &&
654-
test_when_finished git notes --ref=note2 remove topic unmodified &&
655655
git range-diff --no-color --notes=note1 --notes=note2 main..topic main..unmodified \
656656
>actual &&
657657
sed s/Z/\ /g >expect <<-EOF &&
@@ -679,25 +679,25 @@ test_expect_success 'range-diff with multiple --notes' '
679679

680680
# `range-diff` should act like `log` with regards to notes
681681
test_expect_success 'range-diff with --notes=custom does not show default notes' '
682+
test_when_finished "git notes remove topic unmodified || :" &&
682683
git notes add -m "topic note" topic &&
683684
git notes add -m "unmodified note" unmodified &&
685+
test_when_finished "git notes --ref=custom remove topic unmodified || :" &&
684686
git notes --ref=custom add -m "topic note" topic &&
685687
git notes --ref=custom add -m "unmodified note" unmodified &&
686-
test_when_finished git notes remove topic unmodified &&
687-
test_when_finished git notes --ref=custom remove topic unmodified &&
688688
git range-diff --notes=custom main..topic main..unmodified \
689689
>actual &&
690690
! grep "## Notes ##" actual &&
691691
grep "## Notes (custom) ##" actual
692692
'
693693

694694
test_expect_success 'format-patch --range-diff does not compare notes by default' '
695+
test_when_finished "git notes remove topic unmodified || :" &&
695696
git notes add -m "topic note" topic &&
696697
git notes add -m "unmodified note" unmodified &&
697-
test_when_finished git notes remove topic unmodified &&
698+
test_when_finished "rm -f 000?-*" &&
698699
git format-patch --cover-letter --range-diff=$prev \
699700
main..unmodified >actual &&
700-
test_when_finished "rm 000?-*" &&
701701
test_line_count = 5 actual &&
702702
test_grep "^Range-diff:$" 0000-* &&
703703
grep "= 1: .* s/5/A" 0000-* &&
@@ -709,26 +709,26 @@ test_expect_success 'format-patch --range-diff does not compare notes by default
709709
'
710710

711711
test_expect_success 'format-patch --notes=custom --range-diff only compares custom notes' '
712+
test_when_finished "git notes remove topic unmodified || :" &&
712713
git notes add -m "topic note" topic &&
713-
git notes --ref=custom add -m "topic note (custom)" topic &&
714714
git notes add -m "unmodified note" unmodified &&
715+
test_when_finished "git notes --ref=custom remove topic unmodified || :" &&
716+
git notes --ref=custom add -m "topic note (custom)" topic &&
715717
git notes --ref=custom add -m "unmodified note (custom)" unmodified &&
716-
test_when_finished git notes remove topic unmodified &&
717-
test_when_finished git notes --ref=custom remove topic unmodified &&
718+
test_when_finished "rm -f 000?-*" &&
718719
git format-patch --notes=custom --cover-letter --range-diff=$prev \
719720
main..unmodified >actual &&
720-
test_when_finished "rm 000?-*" &&
721721
grep "## Notes (custom) ##" 0000-* &&
722722
! grep "## Notes ##" 0000-*
723723
'
724724

725725
test_expect_success 'format-patch --range-diff with --no-notes' '
726+
test_when_finished "git notes remove topic unmodified || :" &&
726727
git notes add -m "topic note" topic &&
727728
git notes add -m "unmodified note" unmodified &&
728-
test_when_finished git notes remove topic unmodified &&
729+
test_when_finished "rm -f 000?-*" &&
729730
git format-patch --no-notes --cover-letter --range-diff=$prev \
730731
main..unmodified >actual &&
731-
test_when_finished "rm 000?-*" &&
732732
test_line_count = 5 actual &&
733733
test_grep "^Range-diff:$" 0000-* &&
734734
grep "= 1: .* s/5/A" 0000-* &&
@@ -740,12 +740,12 @@ test_expect_success 'format-patch --range-diff with --no-notes' '
740740
'
741741

742742
test_expect_success 'format-patch --range-diff with --notes' '
743+
test_when_finished "git notes remove topic unmodified || :" &&
743744
git notes add -m "topic note" topic &&
744745
git notes add -m "unmodified note" unmodified &&
745-
test_when_finished git notes remove topic unmodified &&
746+
test_when_finished "rm -f 000?-*" &&
746747
git format-patch --notes --cover-letter --range-diff=$prev \
747748
main..unmodified >actual &&
748-
test_when_finished "rm 000?-*" &&
749749
test_line_count = 5 actual &&
750750
test_grep "^Range-diff:$" 0000-* &&
751751
grep "= 1: .* s/5/A" 0000-* &&
@@ -768,13 +768,13 @@ test_expect_success 'format-patch --range-diff with --notes' '
768768
'
769769

770770
test_expect_success 'format-patch --range-diff with format.notes config' '
771+
test_when_finished "git notes remove topic unmodified || :" &&
771772
git notes add -m "topic note" topic &&
772773
git notes add -m "unmodified note" unmodified &&
773-
test_when_finished git notes remove topic unmodified &&
774774
test_config format.notes true &&
775+
test_when_finished "rm -f 000?-*" &&
775776
git format-patch --cover-letter --range-diff=$prev \
776777
main..unmodified >actual &&
777-
test_when_finished "rm 000?-*" &&
778778
test_line_count = 5 actual &&
779779
test_grep "^Range-diff:$" 0000-* &&
780780
grep "= 1: .* s/5/A" 0000-* &&
@@ -797,15 +797,15 @@ test_expect_success 'format-patch --range-diff with format.notes config' '
797797
'
798798

799799
test_expect_success 'format-patch --range-diff with multiple notes' '
800+
test_when_finished "git notes --ref=note1 remove topic unmodified || :" &&
800801
git notes --ref=note1 add -m "topic note1" topic &&
801802
git notes --ref=note1 add -m "unmodified note1" unmodified &&
802-
test_when_finished git notes --ref=note1 remove topic unmodified &&
803+
test_when_finished "git notes --ref=note2 remove topic unmodified || :" &&
803804
git notes --ref=note2 add -m "topic note2" topic &&
804805
git notes --ref=note2 add -m "unmodified note2" unmodified &&
805-
test_when_finished git notes --ref=note2 remove topic unmodified &&
806+
test_when_finished "rm -f 000?-*" &&
806807
git format-patch --notes=note1 --notes=note2 --cover-letter --range-diff=$prev \
807808
main..unmodified >actual &&
808-
test_when_finished "rm 000?-*" &&
809809
test_line_count = 5 actual &&
810810
test_grep "^Range-diff:$" 0000-* &&
811811
grep "= 1: .* s/5/A" 0000-* &&

0 commit comments

Comments
 (0)