diff options
-rwxr-xr-x | t/t0000-basic.sh | 6 | ||||
-rw-r--r-- | t/test-lib.sh | 21 |
2 files changed, 23 insertions, 4 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 2887677391..960208504b 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -84,7 +84,11 @@ donthaveit=yes test_expect_success HAVEIT,DONTHAVEIT 'unmet prerequisites causes test to be skipped' ' donthaveit=no ' -if test $haveit$donthaveit != yesyes +donthaveiteither=yes +test_expect_success DONTHAVEIT,HAVEIT 'unmet prerequisites causes test to be skipped' ' + donthaveiteither=no +' +if test $haveit$donthaveit$donthaveiteither != yesyesyes then say "bug in test framework: multiple prerequisite tags do not work reliably" exit 1 diff --git a/t/test-lib.sh b/t/test-lib.sh index 78c4874465..46179988a3 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -332,15 +332,30 @@ test_have_prereq () { IFS=, set -- $* IFS=$save_IFS + + total_prereq=0 + ok_prereq=0 + missing_prereq= + for prerequisite do + total_prereq=$(($total_prereq + 1)) case $satisfied in *" $prerequisite "*) - : yes, have it ;; + ok_prereq=$(($ok_prereq + 1)) + ;; *) - ! : nope ;; + # Keep a list of missing prerequisites + if test -z "$missing_prereq" + then + missing_prereq=$prerequisite + else + missing_prereq="$prerequisite,$missing_prereq" + fi esac done + + test $total_prereq = $ok_prereq } # You are not expected to call test_ok_ and test_failure_ directly, use @@ -403,7 +418,7 @@ test_skip () { case "$to_skip" in t) say_color skip >&3 "skipping test: $@" - say_color skip "ok $test_count # skip $1 (prereqs: $prereq)" + say_color skip "ok $test_count # skip $1 (missing $missing_prereq of $prereq)" : true ;; *) |