File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Expand file tree Collapse file tree 3 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ Running test_fake_echo_stdin_when_no_params... SUCCESS
8282Running test_fake_exports_faked_in_subshells... SUCCESS
8383Running test_fake_transmits_params_to_fake_code... SUCCESS
8484Running test_one_test_should_stop_after_first_assertion_failure... SUCCESS
85+ Running test_one_test_should_stop_when_assert_fails... SUCCESS
8586Running test_run_all_file_parameters... SUCCESS
8687Running test_run_all_tests_even_in_case_of_failure... SUCCESS
8788Running test_run_only_tests_that_match_pattern... SUCCESS
@@ -112,6 +113,7 @@ Running test_assert_status_code_succeeds... SUCCESS
112113Running test_assert_succeeds... SUCCESS
113114Running test_fail_fails... SUCCESS
114115Running test_one_test_should_stop_after_first_assertion_failure... SUCCESS
116+ Running test_one_test_should_stop_when_assert_fails... SUCCESS
115117```
116118
117119# How to write tests
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ _assert_expression() {
8383 then
8484 fail " $( eval echo $message ) " $stdout $stderr
8585 fi
86- )
86+ ) || exit $?
8787}
8888
8989assert_equals () {
Original file line number Diff line number Diff line change @@ -225,6 +225,13 @@ test_one_test_should_stop_after_first_assertion_failure() {
225225
226226}
227227
228+ test_one_test_should_stop_when_assert_fails () {
229+ # FIX https://github.com/pgrange/bash_unit/issues/26
230+ assert_equals " before failure" \
231+ " $( $BASH_UNIT <( echo ' test_fail() { echo "before failure" >&2 ; assert false ; echo "after failure" >&2 ; }' ) 2>&1 > /dev/null) "
232+
233+ }
234+
228235test_bash_unit_changes_cwd_to_current_test_file_directory () {
229236 assert " ls ../tests/$( basename $BASH_SOURCE ) " \
230237 " bash_unit should change current working directory to match the directory of the currenlty running test"
You can’t perform that action at this time.
0 commit comments