Skip to content

Commit 7d0ee47

Browse files
dschogitster
authored andcommitted
tests: introduce test_unset_prereq, for debugging
While working on the --convert-graft-file test, I missed that I was relying on the GPG prereq, by using output of test cases that were only run under that prereq. For debugging, it was really convenient to force that prereq to be unmet, but there was no easy way to do that. So I came up with a way, and this patch reflects the cleaned-up version of that way. For convenience, the following two methods are now supported ways to pretend that a prereq is not met: test_set_prereq !GPG and test_unset_prereq GPG Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 468165c commit 7d0ee47

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

t/test-lib-functions.sh

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,20 @@ write_script () {
278278
# The single parameter is the prerequisite tag (a simple word, in all
279279
# capital letters by convention).
280280

281+
test_unset_prereq () {
282+
! test_have_prereq "$1" ||
283+
satisfied_prereq="${satisfied_prereq% $1 *} ${satisfied_prereq#* $1 }"
284+
}
285+
281286
test_set_prereq () {
282-
satisfied_prereq="$satisfied_prereq$1 "
287+
case "$1" in
288+
!*)
289+
test_unset_prereq "${1#!}"
290+
;;
291+
*)
292+
satisfied_prereq="$satisfied_prereq$1 "
293+
;;
294+
esac
283295
}
284296
satisfied_prereq=" "
285297
lazily_testable_prereq= lazily_tested_prereq=

0 commit comments

Comments
 (0)