From: Ævar Arnfjörð Bjarmason Date: Sun, 3 Oct 2010 19:59:59 +0000 (-0600) Subject: test-lib: make test_expect_code a test command X-Git-Tag: v1.7.4-rc0~65^2~19 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=892e6f7ea61e39d8504e3f227ee3ae874521f05c;p=git.git test-lib: make test_expect_code a test command Change test_expect_code to be a normal test command instead of a top-level command. As a top-level command it would fail in cases like: test_expect_code 1 'phoney' ' foo && bar && (exit 1) ' Here the test might incorrectly succeed if "foo" or "bar" happened to fail with exit status 1. Instead we now do: test_expect_success 'phoney' ' foo && bar && test_expect_code 1 "(exit 1)" ' Which will only succeed if "foo" and "bar" return status 0, and "(exit 1)" returns status 1. Note that test_expect_code has been made slightly noisier, as it reports the exit code it receives even upon success. Some test code in t0000-basic.sh relied on the old semantics of test_expect_code to test the test_when_finished command. I've converted that code to use an external test similar to the TODO test I added in v1.7.3-rc0~2^2~3. Signed-off-by: Ævar Arnfjörð Bjarmason Acked-by: Jonathan Nieder Signed-off-by: Elijah Newren Signed-off-by: Junio C Hamano --- diff --git a/t/README b/t/README index a1eb7c872..ee4c0cf68 100644 --- a/t/README +++ b/t/README @@ -395,13 +395,6 @@ library for your script to use. Like test_expect_success this function can optionally use a three argument invocation with a prerequisite as the first argument. - - test_expect_code []