test-lib: Print missing prerequisites in test output
[gitweb.git] / t / test-lib.sh
index 5467cc626b09b9fa02b07264e6e7a99c50b0ac8a..9ded0eee18e7479b0674a7bce217de46744b1dff 100644 (file)
@@ -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
@@ -395,7 +403,7 @@ test_skip () {
        case "$to_skip" in
        t)
                say_color skip >&3 "skipping test: $@"
-               say_color skip "ok $test_count # skip $1"
+               say_color skip "ok $test_count # skip $1 (prereqs: $prereq)"
                : true
                ;;
        *)