---
 test/test-lib.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index ff85848..f21e45e 100755
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -622,82 +622,85 @@ test_skip () {
                test_reset_state_
                say_color skip >&3 "skipping test: $@"
                say_color skip "%-6s" "SKIP"
                echo " $1"
                : true
                ;;
        *)
                false
                ;;
        esac
 }

 test_subtest_known_broken () {
        test_subtest_known_broken_=t
 }

 test_expect_success () {
        test "$#" = 3 && { prereq=$1; shift; } || prereq=
        test "$#" = 2 ||
        error "bug in the test script: not 2 or 3 parameters to 
test-expect-success"
+       test_reset_state_
        if ! test_skip "$@"
        then
                test_run_ "$2"
                if [ "$?" = 0 -a "$eval_ret" = 0 ]
                then
                        test_ok_ "$1"
                else
                        test_failure_ "$@"
                fi
        fi
 }

 test_expect_code () {
        test "$#" = 4 && { prereq=$1; shift; } || prereq=
        test "$#" = 3 ||
        error "bug in the test script: not 3 or 4 parameters to 
test-expect-code"
+       test_reset_state_
        if ! test_skip "$@"
        then
                test_run_ "$3"
                if [ "$?" = 0 -a "$eval_ret" = "$1" ]
                then
                        test_ok_ "$2"
                else
                        test_failure_ "$@"
                fi
        fi
 }

 # test_external runs external test scripts that provide continuous
 # test output about their progress, and succeeds/fails on
 # zero/non-zero exit code.  It outputs the test output on stdout even
 # in non-verbose mode, and announces the external script with "* run
 # <n>: ..." before running it.  When providing relative paths, keep in
 # mind that all scripts run in "trash directory".
 # Usage: test_external description command arguments...
 # Example: test_external 'Perl API' perl ../path/to/test.pl
 test_external () {
        test "$#" = 4 && { prereq=$1; shift; } || prereq=
        test "$#" = 3 ||
        error >&5 "bug in the test script: not 3 or 4 parameters to 
test_external"
        descr="$1"
        shift
+       test_reset_state_
        if ! test_skip "$descr" "$@"
        then
                # Announce the script to reduce confusion about the
                # test output that follows.
                say_color "" " run $test_count: $descr ($*)"
                # Run command; redirect its stderr to &4 as in
                # test_run_, but keep its stdout on our stdout even in
                # non-verbose mode.
                "$@" 2>&4
                if [ "$?" = 0 ]
                then
                        test_ok_ "$descr"
                else
                        test_failure_ "$descr" "$@"
                fi
        fi
 }

 # Like test_external, but in addition tests that the command generated
 # no output on stderr.
-- 
1.7.7.2

Reply via email to