Skip to content

Commit cc88876

Browse files
committed
fix: bash_unit should fail when setup_suite fails
1 parent d527e71 commit cc88876

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

bash_unit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ run_test_suite() {
220220
then
221221
run_tests || failure=$?
222222
else
223-
failure=$?
223+
failure=1
224224
fi
225225
run_teardown_suite
226226

tests/test_cli.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,12 @@ test_bash_unit_runs_teardown_suite_even_in_case_of_failure_setup_suite() {
165165
"$($BASH_UNIT <(echo 'setup_suite() { return 1 ; } ; teardown_suite() { echo "ran teardown_suite" >&2 ; }') 2>&1 >/dev/null)"
166166
}
167167

168+
test_bash_unit_fails_in_case_of_failure_setup_suite() {
169+
#FIX https://github.com/bash-unit/bash_unit/issues/135
170+
assert_fail \
171+
"$BASH_UNIT <(echo 'setup_suite() { return 2 ; } ') 2>&1 >/dev/null"
172+
}
173+
168174
test_one_test_should_stop_after_first_assertion_failure() {
169175
#FIX https://github.com/bash-unit/bash_unit/issues/10
170176
assert_equals "before failure" \

0 commit comments

Comments
 (0)