summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-08-08 01:15:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-08 18:26:40 (GMT)
commitaa0bcf962a6657226b729f263ca4b8e768ed6d5d (patch)
tree1eb87689bf91bb2ac6a87336472708f39154eabf /t/test-lib.sh
parente9e0643fe64b613b6596b79b59df8ff10746f1a1 (diff)
downloadgit-aa0bcf962a6657226b729f263ca4b8e768ed6d5d.zip
git-aa0bcf962a6657226b729f263ca4b8e768ed6d5d.tar.gz
git-aa0bcf962a6657226b729f263ca4b8e768ed6d5d.tar.bz2
test: simplify return value of test_run_
As v0.99.5~24^2~4 (Trapping exit in tests, using return for errors, 2005-08-10) explains, callers to test_run_ (such as test_expect_code) used to check the result from eval and the return value separately so tests that fail early could be distinguished from tests that completed normally with successful (nonzero) status. Eventually tests that succeed with nonzero status were phased out (see v1.7.4-rc0~65^2~19, 2010-10-03 and especially v1.5.5-rc0~271, 2008-02-01) but the weird two-return-value calling convention lives on. Let's get rid of it. The new rule: test_run_ succeeds (returns 0) if and only if the test succeeded. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh8
1 files changed, 3 insertions, 5 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index df25f17..b16a9b9 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -457,7 +457,7 @@ test_run_ () {
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"; then
echo ""
fi
- return 0
+ return "$eval_ret"
}
test_skip () {
@@ -502,8 +502,7 @@ test_expect_failure () {
if ! test_skip "$@"
then
say >&3 "checking known breakage: $2"
- test_run_ "$2" expecting_failure
- if [ "$?" = 0 -a "$eval_ret" = 0 ]
+ if test_run_ "$2" expecting_failure
then
test_known_broken_ok_ "$1"
else
@@ -521,8 +520,7 @@ test_expect_success () {
if ! test_skip "$@"
then
say >&3 "expecting success: $2"
- test_run_ "$2"
- if [ "$?" = 0 -a "$eval_ret" = 0 ]
+ if test_run_ "$2"
then
test_ok_ "$1"
else