summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2018-04-28 22:33:36 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-04-30 00:38:51 (GMT)
commit7d0ee47c11ffe3c63800625fcf757b05cf4b28c1 (patch)
tree02ed746c379babc1637d4f1bc69146ef74c25bb8 /t/test-lib-functions.sh
parent468165c1d8a442994a825f3684528361727cd8c0 (diff)
downloadgit-7d0ee47c11ffe3c63800625fcf757b05cf4b28c1.zip
git-7d0ee47c11ffe3c63800625fcf757b05cf4b28c1.tar.gz
git-7d0ee47c11ffe3c63800625fcf757b05cf4b28c1.tar.bz2
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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index b895366..dfe99b0 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -278,8 +278,20 @@ write_script () {
# The single parameter is the prerequisite tag (a simple word, in all
# capital letters by convention).
+test_unset_prereq () {
+ ! test_have_prereq "$1" ||
+ satisfied_prereq="${satisfied_prereq% $1 *} ${satisfied_prereq#* $1 }"
+}
+
test_set_prereq () {
- satisfied_prereq="$satisfied_prereq$1 "
+ case "$1" in
+ !*)
+ test_unset_prereq "${1#!}"
+ ;;
+ *)
+ satisfied_prereq="$satisfied_prereq$1 "
+ ;;
+ esac
}
satisfied_prereq=" "
lazily_testable_prereq= lazily_tested_prereq=