summaryrefslogtreecommitdiffstats
path: root/tests/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-12-16 15:32:04 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-12-16 15:32:04 -0500
commite50c19f284dad6b4b7b79f91cc8576a97626be8a (patch)
tree3fc7b15a412d4123d403bca6fdbf3225389926e1 /tests/tests.sh
parent7d87b96b421b76e387cee903b7b7c1bc16c54310 (diff)
downloadbfs-e50c19f284dad6b4b7b79f91cc8576a97626be8a.tar.xz
tests: Turn on set -e
Diffstat (limited to 'tests/tests.sh')
-rwxr-xr-xtests/tests.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/tests.sh b/tests/tests.sh
index 844de5c..7ccd9b5 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -476,16 +476,24 @@ function bfs_verbose() {
function invoke_bfs() {
bfs_verbose "$@"
"${BFS[@]}" "$@"
- local status=$?
+ local status="$?"
# Allow bfs to fail, but not crash
if ((status > 125)); then
- exit $status
+ exit "$status"
else
- return $status
+ return "$status"
fi
}
+function check_exit() {
+ local expected="$1"
+ local actual="0"
+ shift
+ "$@" || actual="$?"
+ ((actual == expected))
+}
+
# Detect colored diff support
if [ -t 2 ] && diff --color=always /dev/null /dev/null 2>/dev/null; then
DIFF="diff --color=always"
@@ -655,9 +663,9 @@ for TEST in "${TEST_CASES[@]}"; do
mkdir -p "${OUT%/*}"
if [ "$VERBOSE_ERRORS" ]; then
- (. "$TESTS/$TEST.sh")
+ (set -e; . "$TESTS/$TEST.sh")
else
- (. "$TESTS/$TEST.sh") 2>"$TMP/stderr"
+ (set -e; . "$TESTS/$TEST.sh") 2>"$TMP/stderr"
fi
status=$?