summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d8a9480)
raw | patch | inline | side by side (parent: d8a9480)
author | Jeff King <peff@peff.net> | |
Tue, 31 Aug 2010 15:56:36 +0000 (11:56 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 31 Aug 2010 16:53:56 +0000 (09:53 -0700) |
Because test_must_fail fails when a command succeeds, the
command frequently does not produce any output (since, after
all, it thought it was succeeding). So let's have
test_must_fail itself report that a problem occurred.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
command frequently does not produce any output (since, after
all, it thought it was succeeding). So let's have
test_must_fail itself report that a problem occurred.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh | patch | blob | history |
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3a3d4c4723d4dece710f4f959ab689e1f8fb8760..285bfd89433461e62051e2bfd45e8b7e83638c0c 100644 (file)
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
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
+ fi
+ return 0
}
# Similar to test_must_fail, but tolerates success, too. This is