Use fail and assertFail where appropriate in command-line tests

This commit is contained in:
Kamil Śliwak
2021-10-14 18:56:08 +02:00
parent 3b1b9a0bfb
commit 0280c8d00e
2 changed files with 26 additions and 18 deletions
+6 -1
View File
@@ -19,6 +19,9 @@
# (c) 2016-2019 solidity contributors.
# ------------------------------------------------------------------------------
# The fail() function defined below requires set -e to be enabled.
set -e
# Save the initial working directory so that printStackTrace() can access it even if the sourcing
# changes directory. The paths returned by `caller` are relative to it.
_initial_work_dir=$(pwd)
@@ -78,6 +81,8 @@ function printStackTrace
function fail()
{
printError "$@"
# Using return rather than exit lets the invoking code handle the failure by suppressing the exit code.
return 1
}
@@ -120,7 +125,7 @@ function msg_on_error()
shift
;;
*)
fail "Invalid option for msg_on_error: $1"
assertFail "Invalid option for msg_on_error: $1"
;;
esac
done