summaryrefslogtreecommitdiffstats
path: root/tests/tests.sh
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-12-16 14:39:18 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-12-16 15:06:25 -0500
commit7d87b96b421b76e387cee903b7b7c1bc16c54310 (patch)
treee5c90a458a1418578cf31fd80301f6f99ab96251 /tests/tests.sh
parente01042b84abdfa224d47e6d11eb9798ce4c7d2f8 (diff)
downloadbfs-7d87b96b421b76e387cee903b7b7c1bc16c54310.tar.xz
tests: Move crash detection into invoke_bfs, use ! instead of fail
Diffstat (limited to 'tests/tests.sh')
-rwxr-xr-xtests/tests.sh16
1 files changed, 5 insertions, 11 deletions
diff --git a/tests/tests.sh b/tests/tests.sh
index 3047bf4..844de5c 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -476,19 +476,13 @@ function bfs_verbose() {
function invoke_bfs() {
bfs_verbose "$@"
"${BFS[@]}" "$@"
-}
-
-# Expect a command to fail, but not crash
-function fail() {
- "$@"
- local STATUS="$?"
+ local status=$?
- if ((STATUS > 125)); then
- exit "$STATUS"
- elif ((STATUS > 0)); then
- return 0
+ # Allow bfs to fail, but not crash
+ if ((status > 125)); then
+ exit $status
else
- return 1
+ return $status
fi
}