tests: make test_must_fail fail on missing commands
authorJeff King <peff@peff.net>
Tue, 31 Aug 2010 15:56:53 +0000 (11:56 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Aug 2010 16:54:37 +0000 (09:54 -0700)
The point of it is to run a command that produces failure. A
missing command is more likely an error in the test script
(e.g., using 'test_must_fail "command with arguments"', or
relying on a missing command).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh

index 285bfd89433461e62051e2bfd45e8b7e83638c0c..dbb13af33eb8e12a13992e63a2c00748d29f8495 100644 (file)
@@ -598,6 +598,9 @@ test_must_fail () {
        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
 }