Skip to content

Commit

Permalink
tests: make test_must_fail fail on missing commands
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Aug 31, 2010
1 parent 16034fb commit a54ce3c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit a54ce3c

Please sign in to comment.