diff options
author | Junio C Hamano <gitster@pobox.com> | 2011-08-23 15:35:26 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-08-23 15:35:26 -0700 |
commit | 52457205a2301d66848fd965c928bc4e0360e2aa (patch) | |
tree | 72520aa2bf9ac68aa97bf795dfefd3e43dbcab9c /t | |
parent | Merge branch 'cb/maint-ls-files-error-report' (diff) | |
parent | t3900: do not reference numbered arguments from the test script (diff) | |
download | tgif-52457205a2301d66848fd965c928bc4e0360e2aa.tar.xz |
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_
Diffstat (limited to 't')
-rwxr-xr-x | t/t3900-i18n-commit.sh | 4 | ||||
-rw-r--r-- | t/test-lib.sh | 18 |
2 files changed, 13 insertions, 9 deletions
diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index c06a5ee766..1f62c151b0 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -147,7 +147,7 @@ test_commit_autosquash_flags () { git commit -a -m "intermediate commit" && test_tick && echo $H $flag >>F && - git commit -a --$flag HEAD~1 $3 && + git commit -a --$flag HEAD~1 && E=$(git cat-file commit '$H-$flag' | sed -ne "s/^encoding //p") && test "z$E" = "z$H" && @@ -160,6 +160,6 @@ test_commit_autosquash_flags () { 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 diff --git a/t/test-lib.sh b/t/test-lib.sh index df25f17929..57c3d53293 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -444,20 +444,26 @@ test_debug () { 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_cleanup=: expecting_failure=$2 - eval >&3 2>&4 "$1" + test_eval_ "$1" eval_ret=$? if test -z "$immediate" || test $eval_ret = 0 || test -n "$expecting_failure" then - eval >&3 2>&4 "$test_cleanup" + test_eval_ "$test_cleanup" fi if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"; then echo "" fi - return 0 + return "$eval_ret" } test_skip () { @@ -502,8 +508,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 +526,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 |