File tree 3 files changed +10
-1
lines changed
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
82
82
Running test_fake_exports_faked_in_subshells... SUCCESS
83
83
Running test_fake_transmits_params_to_fake_code... SUCCESS
84
84
Running test_one_test_should_stop_after_first_assertion_failure... SUCCESS
85
+ Running test_one_test_should_stop_when_assert_fails... SUCCESS
85
86
Running test_run_all_file_parameters... SUCCESS
86
87
Running test_run_all_tests_even_in_case_of_failure... SUCCESS
87
88
Running test_run_only_tests_that_match_pattern... SUCCESS
@@ -112,6 +113,7 @@ Running test_assert_status_code_succeeds... SUCCESS
112
113
Running test_assert_succeeds... SUCCESS
113
114
Running test_fail_fails... SUCCESS
114
115
Running test_one_test_should_stop_after_first_assertion_failure... SUCCESS
116
+ Running test_one_test_should_stop_when_assert_fails... SUCCESS
115
117
```
116
118
117
119
# How to write tests
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ _assert_expression() {
83
83
then
84
84
fail " $( eval echo $message ) " $stdout $stderr
85
85
fi
86
- )
86
+ ) || exit $?
87
87
}
88
88
89
89
assert_equals () {
Original file line number Diff line number Diff line change @@ -225,6 +225,13 @@ test_one_test_should_stop_after_first_assertion_failure() {
225
225
226
226
}
227
227
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
+
228
235
test_bash_unit_changes_cwd_to_current_test_file_directory () {
229
236
assert " ls ../tests/$( basename $BASH_SOURCE ) " \
230
237
" 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