From ebc65c66cf5ea41ef0d5010341a1ff69ce2733f5 Mon Sep 17 00:00:00 2001 From: Jussi Pekonen Date: Mon, 27 Jun 2022 22:45:45 +0300 Subject: [PATCH] Exit instead of returning when there are failures With return statement, running tests using `shunit2 ` will print out a warning message "can only `return' from a function or sourced script". This regression has been introduced after the 2.1.8 release. --- shunit2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shunit2 b/shunit2 index 57a45da..fb955cc 100755 --- a/shunit2 +++ b/shunit2 @@ -1373,5 +1373,5 @@ _shunit_generateReport # That's it folks. if ! ${__SHUNIT_BUILTIN} [ "${__shunit_testsFailed}" -eq 0 ]; then - return ${SHUNIT_FALSE} + exit ${SHUNIT_FALSE} fi