@matheusbsbs / matheus-bagliano / commits / a54ce3ca9e
Fork 0

tests: make test_must_fail fail on missing commands

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>

Jeff King committed Aug 31, 2010 at 11:56 UTC a54ce3ca9e780f824f07519a6db83fe2d7575734
1 file changed +3
t/test-lib.sh
+3
@@ -598,6 +598,9 @@ test_must_fail () {
598 elif test $exit_code -gt 129 -a $exit_code -le 192; then
599 echo >&2 "test_must_fail: died by signal: $*"
600 return 1
601 + elif test $exit_code = 127; then
602 + echo >&2 "test_must_fail: command not found: $*"
603 + return 1
604 fi
605 return 0
606 }