Skip to content

Commit

Permalink
tests: make test_might_fail fail on missing commands
Browse files Browse the repository at this point in the history
Detect and report hard-to-notice spelling mistakes like

 test_might_fail "git config --unset whatever"

(the extra quotes prevent the shell from running git as intended;
instead, the shell looks for a "git config --unset whatever" file).

Cc: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Aug 31, 2010
1 parent 5c8e141 commit d0b8a61
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 @@ -622,6 +622,9 @@ test_might_fail () {
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
}
Expand Down

0 comments on commit d0b8a61

Please sign in to comment.