Skip to content

Commit 7ccbea5

Browse files
avargitster
authored andcommitted
add -i tests: mark "TODO" depending on GIT_TEST_ADD_I_USE_BUILTIN
Fix an issue that existed before 0527ccb (add -i: default to the built-in implementation, 2021-11-30), but which became the default with that change, we should not be marking tests that are known to pass as "TODO" tests. When GIT_TEST_ADD_I_USE_BUILTIN=1 was made the default we started passing the tests added in 0f0fba2 (t3701: add a test for advanced split-hunk editing, 2019-12-06) and 1bf0104 (add -p: demonstrate failure when running 'edit' after a split, 2015-04-16). Thus we've been emitting this sort of output: $ prove ./t3701-add-interactive.sh ./t3701-add-interactive.sh .. ok All tests successful. Test Summary Report ------------------- ./t3701-add-interactive.sh (Wstat: 0 Tests: 70 Failed: 0) TODO passed: 45, 47 Files=1, Tests=70, 2 wallclock secs ( 0.03 usr 0.00 sys + 0.86 cusr 0.33 csys = 1.22 CPU) Result: PASS Which isn't just cosmetic, but due to issues with test_expect_failure (see [1]) we could e.g. be hiding something as bad as a segfault in the new implementation. It makes sense catch that, especially before we put out a release with the built-in "add -i", so let's generalize the check we were already doing in 0527ccb with a new "ADD_I_USE_BUILTIN" prerequisite. 1. https://lore.kernel.org/git/[email protected]/ Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 8168d5e commit 7ccbea5

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

t/t2016-checkout-patch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_description='git checkout --patch'
44

55
. ./lib-patch-mode.sh
66

7-
if ! test_bool_env GIT_TEST_ADD_I_USE_BUILTIN true && ! test_have_prereq PERL
7+
if ! test_have_prereq ADD_I_USE_BUILTIN && ! test_have_prereq PERL
88
then
99
skip_all='skipping interactive add tests, PERL not set'
1010
test_done

t/t3701-add-interactive.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,15 @@ test_expect_success 'split hunk "add -p (edit)"' '
538538
! grep "^+15" actual
539539
'
540540

541-
test_expect_failure 'split hunk "add -p (no, yes, edit)"' '
541+
test_expect_success 'setup ADD_I_USE_BUILTIN check' '
542+
result=success &&
543+
if ! test_have_prereq ADD_I_USE_BUILTIN
544+
then
545+
result=failure
546+
fi
547+
'
548+
549+
test_expect_$result 'split hunk "add -p (no, yes, edit)"' '
542550
test_write_lines 5 10 20 21 30 31 40 50 60 >test &&
543551
git reset &&
544552
# test sequence is s(plit), n(o), y(es), e(dit)
@@ -562,7 +570,7 @@ test_expect_success 'split hunk with incomplete line at end' '
562570
test_must_fail git grep --cached before
563571
'
564572

565-
test_expect_failure 'edit, adding lines to the first hunk' '
573+
test_expect_$result 'edit, adding lines to the first hunk' '
566574
test_write_lines 10 11 20 30 40 50 51 60 >test &&
567575
git reset &&
568576
tr _ " " >patch <<-EOF &&

t/test-lib.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,10 @@ test_lazy_prereq SHA1 '
17591759
esac
17601760
'
17611761

1762+
test_lazy_prereq ADD_I_USE_BUILTIN '
1763+
test_bool_env GIT_TEST_ADD_I_USE_BUILTIN true
1764+
'
1765+
17621766
# Ensure that no test accidentally triggers a Git command
17631767
# that runs the actual maintenance scheduler, affecting a user's
17641768
# system permanently.

0 commit comments

Comments
 (0)