summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2010-08-06 21:19:23 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-08-18 12:42:04 -0700
commit93a5724613861e6cd85964c85f2fa0891caab258 (patch)
tree33a0e1d47bb638b277ac91a3e9b370f92506aad7 /t/test-lib.sh
parenttest-lib: Don't write test-results when HARNESS_ACTIVE (diff)
downloadtgif-93a5724613861e6cd85964c85f2fa0891caab258.tar.xz
test-lib: Add support for multiple test prerequisites
Change the test_have_prereq function in test-lib.sh to support a comma-separated list of prerequisites. This is useful for tests that need e.g. both POSIXPERM and SANITY. The implementation was stolen from Junio C Hamano and Johannes Sixt, the tests and documentation were not. See the "Tests in Cygwin" thread in May 2009 for the originals: http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385 http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118434 Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 5467cc626b..0b9969ccf7 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -327,12 +327,20 @@ test_set_prereq () {
satisfied=" "
test_have_prereq () {
- case $satisfied in
- *" $1 "*)
- : yes, have it ;;
- *)
- ! : nope ;;
- esac
+ # prerequisites can be concatenated with ','
+ save_IFS=$IFS
+ IFS=,
+ set -- $*
+ IFS=$save_IFS
+ for prerequisite
+ do
+ case $satisfied in
+ *" $prerequisite "*)
+ : yes, have it ;;
+ *)
+ ! : nope ;;
+ esac
+ done
}
# You are not expected to call test_ok_ and test_failure_ directly, use