Code

Skip t1300.70 and 71 on msysGit.
[git.git] / t / test-lib.sh
index dff5e25ae6ca4022d5bdea8673988987c10bfec7..a85e7954adb857253375e8eefa31124d6b189160 100644 (file)
@@ -620,7 +620,18 @@ test_path_is_missing () {
 
 test_must_fail () {
        "$@"
-       test $? -gt 0 -a $? -le 129 -o $? -gt 192
+       exit_code=$?
+       if test $exit_code = 0; then
+               echo >&2 "test_must_fail: command succeeded: $*"
+               return 1
+       elif test $exit_code -gt 129 -a $exit_code -le 192; then
+               echo >&2 "test_must_fail: died by signal: $*"
+               return 1
+       elif test $exit_code = 127; then
+               echo >&2 "test_must_fail: command not found: $*"
+               return 1
+       fi
+       return 0
 }
 
 # Similar to test_must_fail, but tolerates success, too.  This is
@@ -636,7 +647,15 @@ test_must_fail () {
 
 test_might_fail () {
        "$@"
-       test $? -ge 0 -a $? -le 129 -o $? -gt 192
+       exit_code=$?
+       if test $exit_code -gt 129 -a $exit_code -le 192; then
+               echo >&2 "test_might_fail: died by signal: $*"
+               return 1
+       elif test $exit_code = 127; then
+               echo >&2 "test_might_fail: command not found: $*"
+               return 1
+       fi
+       return 0
 }
 
 # test_cmp is a helper function to compare actual and expected output.
@@ -956,6 +975,7 @@ case $(uname -s) in
        test_set_prereq POSIXPERM
        test_set_prereq BSLASHPSPEC
        test_set_prereq EXECKEEPSPID
+       test_set_prereq NOT_MINGW
        ;;
 esac