Skip to content

Commit 1fdc9f6

Browse files
authored
Fixes #54 (#59)
1 parent 31f64a2 commit 1fdc9f6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

bash_unit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,16 @@ for test_file in "$@"
364364
do
365365
notify_suite_starting "$test_file"
366366
(
367+
set -e # Ensure bash_unit with exit with failure
368+
# in case of syntax error.
367369
if [[ "${STICK_TO_CWD}" != true ]]
368370
then
369371
cd "$(dirname "$test_file")"
370372
source "$(basename "$test_file")"
371373
else
372374
source "$test_file"
373375
fi
376+
set +e
374377
run_test_suite
375378
)
376379
failure=$(( $? || failure))

tests/test_cli.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ EOF
2323
)"
2424
}
2525

26+
test_exit_code_not_0_in_case_of_syntax_error() {
27+
assert_fails "$BASH_UNIT <($CAT << EOF
28+
function test_fails() { while true ; done ; }
29+
EOF
30+
)"
31+
}
32+
2633
test_run_all_file_parameters() {
2734
bash_unit_output=$($BASH_UNIT \
2835
<(echo "test_one() { echo -n ; }") \

0 commit comments

Comments
 (0)