X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.sh;h=32bd3f1278a446b230dab2c11cca4c01eab6d3be;hp=b68290c3f02fb2be28a296da9b7f89e5c00c9595;hb=0497d695ca796c4d19ad5ec08788bbb1f400c58c;hpb=d0cd253b37646d9364d046e1d3edb022a58c105a diff --git a/test/test-lib.sh b/test/test-lib.sh index b68290c3..32bd3f12 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -940,13 +940,17 @@ test_expect_success () { } test_expect_code () { - test "$#" = 3 || - error "bug in the test script: not 3 parameters to test_expect_code" - test_subtest_name="$2" - test_reset_state_ - if ! test_skip "$@" + exec 1>&6 2>&7 # Restore stdout and stderr + if [ -z "$inside_subtest" ]; then + error "bug in the test script: test_expect_code without test_begin_subtest" + fi + inside_subtest= + test "$#" = 2 || + error "bug in the test script: not 2 parameters to test_expect_code" + + if ! test_skip "$test_subtest_name" then - test_run_ "$3" + test_run_ "$2" run_ret="$?" # test_run_ may update missing external prerequisites, test_check_missing_external_prereqs_ "$@" || @@ -954,7 +958,7 @@ test_expect_code () { then test_ok_ else - test_failure_ "exit code $eval_ret, expected $1" "$3" + test_failure_ "exit code $eval_ret, expected $1" "$2" fi fi }