Skip to content

Commit aa0bcf9

Browse files
jrngitster
authored andcommitted
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 <[email protected]> Acked-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e9e0643 commit aa0bcf9

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

t/test-lib.sh

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ test_run_ () {
457457
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"; then
458458
echo ""
459459
fi
460-
return 0
460+
return "$eval_ret"
461461
}
462462

463463
test_skip () {
@@ -502,8 +502,7 @@ test_expect_failure () {
502502
if ! test_skip "$@"
503503
then
504504
say >&3 "checking known breakage: $2"
505-
test_run_ "$2" expecting_failure
506-
if [ "$?" = 0 -a "$eval_ret" = 0 ]
505+
if test_run_ "$2" expecting_failure
507506
then
508507
test_known_broken_ok_ "$1"
509508
else
@@ -521,8 +520,7 @@ test_expect_success () {
521520
if ! test_skip "$@"
522521
then
523522
say >&3 "expecting success: $2"
524-
test_run_ "$2"
525-
if [ "$?" = 0 -a "$eval_ret" = 0 ]
523+
if test_run_ "$2"
526524
then
527525
test_ok_ "$1"
528526
else

0 commit comments

Comments
 (0)