mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
externalTests: Use fail() function to simplify error checks
This commit is contained in:
parent
b14a674ed4
commit
0edbd90f52
@ -35,18 +35,12 @@ function print_optimizer_levels_or_exit
|
|||||||
|
|
||||||
function verify_input
|
function verify_input
|
||||||
{
|
{
|
||||||
if [ ! -f "$1" ]; then
|
[[ -f "$1" ]] || fail "Usage: $0 <path to soljson.js>"
|
||||||
printError "Usage: $0 <path to soljson.js>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function verify_version_input
|
function verify_version_input
|
||||||
{
|
{
|
||||||
if [ -z "$1" ] || [ ! -f "$1" ] || [ -z "$2" ]; then
|
[[ $1 != "" && -f "$1" && $2 != "" ]] || fail "Usage: $0 <path to soljson.js> <version>"
|
||||||
printError "Usage: $0 <path to soljson.js> <version>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup
|
function setup
|
||||||
@ -248,8 +242,7 @@ function optimizer_settings_for_level
|
|||||||
2) echo "{enabled: true}" ;;
|
2) echo "{enabled: true}" ;;
|
||||||
3) echo "{enabled: true, details: {yul: true}}" ;;
|
3) echo "{enabled: true, details: {yul: true}}" ;;
|
||||||
*)
|
*)
|
||||||
printError "Optimizer level not found. Please define OPTIMIZER_LEVEL=[1, 2, 3]"
|
fail "Optimizer level not found. Please define OPTIMIZER_LEVEL=[1, 2, 3]"
|
||||||
exit 1
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
@ -356,10 +349,7 @@ function external_test
|
|||||||
echo "==========================="
|
echo "==========================="
|
||||||
DIR=$(mktemp -d -t "ext-test-${name}-XXXXXX")
|
DIR=$(mktemp -d -t "ext-test-${name}-XXXXXX")
|
||||||
(
|
(
|
||||||
if [ -z "$main_fn" ]; then
|
[[ "$main_fn" != "" ]] || fail "Test main function not defined."
|
||||||
printError "Test main function not defined."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
$main_fn
|
$main_fn
|
||||||
)
|
)
|
||||||
rm -rf "$DIR"
|
rm -rf "$DIR"
|
||||||
|
Loading…
Reference in New Issue
Block a user