Merge branch 'jn/maint-test-return'
* jn/maint-test-return: t3900: do not reference numbered arguments from the test script test: cope better with use of return for errors test: simplify return value of test_run_
This commit is contained in:
@ -147,7 +147,7 @@ test_commit_autosquash_flags () {
|
|||||||
git commit -a -m "intermediate commit" &&
|
git commit -a -m "intermediate commit" &&
|
||||||
test_tick &&
|
test_tick &&
|
||||||
echo $H $flag >>F &&
|
echo $H $flag >>F &&
|
||||||
git commit -a --$flag HEAD~1 $3 &&
|
git commit -a --$flag HEAD~1 &&
|
||||||
E=$(git cat-file commit '$H-$flag' |
|
E=$(git cat-file commit '$H-$flag' |
|
||||||
sed -ne "s/^encoding //p") &&
|
sed -ne "s/^encoding //p") &&
|
||||||
test "z$E" = "z$H" &&
|
test "z$E" = "z$H" &&
|
||||||
@ -160,6 +160,6 @@ test_commit_autosquash_flags () {
|
|||||||
|
|
||||||
test_commit_autosquash_flags eucJP fixup
|
test_commit_autosquash_flags eucJP fixup
|
||||||
|
|
||||||
test_commit_autosquash_flags ISO-2022-JP squash '-m "squash message"'
|
test_commit_autosquash_flags ISO-2022-JP squash
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -444,20 +444,26 @@ test_debug () {
|
|||||||
test "$debug" = "" || eval "$1"
|
test "$debug" = "" || eval "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_eval_ () {
|
||||||
|
# This is a separate function because some tests use
|
||||||
|
# "return" to end a test_expect_success block early.
|
||||||
|
eval >&3 2>&4 "$*"
|
||||||
|
}
|
||||||
|
|
||||||
test_run_ () {
|
test_run_ () {
|
||||||
test_cleanup=:
|
test_cleanup=:
|
||||||
expecting_failure=$2
|
expecting_failure=$2
|
||||||
eval >&3 2>&4 "$1"
|
test_eval_ "$1"
|
||||||
eval_ret=$?
|
eval_ret=$?
|
||||||
|
|
||||||
if test -z "$immediate" || test $eval_ret = 0 || test -n "$expecting_failure"
|
if test -z "$immediate" || test $eval_ret = 0 || test -n "$expecting_failure"
|
||||||
then
|
then
|
||||||
eval >&3 2>&4 "$test_cleanup"
|
test_eval_ "$test_cleanup"
|
||||||
fi
|
fi
|
||||||
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"; then
|
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"; then
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
return 0
|
return "$eval_ret"
|
||||||
}
|
}
|
||||||
|
|
||||||
test_skip () {
|
test_skip () {
|
||||||
@ -502,8 +508,7 @@ test_expect_failure () {
|
|||||||
if ! test_skip "$@"
|
if ! test_skip "$@"
|
||||||
then
|
then
|
||||||
say >&3 "checking known breakage: $2"
|
say >&3 "checking known breakage: $2"
|
||||||
test_run_ "$2" expecting_failure
|
if test_run_ "$2" expecting_failure
|
||||||
if [ "$?" = 0 -a "$eval_ret" = 0 ]
|
|
||||||
then
|
then
|
||||||
test_known_broken_ok_ "$1"
|
test_known_broken_ok_ "$1"
|
||||||
else
|
else
|
||||||
@ -521,8 +526,7 @@ test_expect_success () {
|
|||||||
if ! test_skip "$@"
|
if ! test_skip "$@"
|
||||||
then
|
then
|
||||||
say >&3 "expecting success: $2"
|
say >&3 "expecting success: $2"
|
||||||
test_run_ "$2"
|
if test_run_ "$2"
|
||||||
if [ "$?" = 0 -a "$eval_ret" = 0 ]
|
|
||||||
then
|
then
|
||||||
test_ok_ "$1"
|
test_ok_ "$1"
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user