[PATCH 10/10] test-lib: return 1 from test_expect_{success,failure}
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Feb 28, 2021, 19:54 UTC
- Message-ID
- <20210228195414.21372-11-avarab@gmail.com>
- In-Reply-To
- <20200223125102.6697-1-benno@bmevers.de>
An earlier commit fixed an issue in "check_describe" with "test_expect_success" being called within another "test_expect_success", causing the test to succeed even if it should fail.
Let's try to guard against this in the test library by returning 1 from these two functions. This change would have caught the issue I've now fixed in the "check_describe" function.
I could equivalently add this "return 1" to the "test_finish_" function itself, but I think doing it here is more readable.
Because of this change any tests which ran under "set -e" needed to be refactored not to use "set -e". Luckily there were only two such tests, earlier commits did that refactoring.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- t/test-lib-functions.sh | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index c6cdabf53e..3dd68091bb 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -636,6 +636,7 @@ test_expect_failure () { fi fi test_finish_ + return 1 } test_expect_success () { @@ -656,6 +657,7 @@ test_expect_success () { fi fi test_finish_ + return 1 } # test_external runs external test scripts that provide continuous
-- 2.31.0.rc0.116.g45ec00aa00