2021-11-19 13:56:30 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# shellcheck source=scripts/common.sh
|
|
|
|
source "${REPO_ROOT}/scripts/common.sh"
|
|
|
|
|
2023-06-01 16:44:23 +00:00
|
|
|
set +e
|
|
|
|
output=$("$SOLC" --bin 2>&1)
|
|
|
|
result=$?
|
|
|
|
set -e
|
2021-11-19 13:56:30 +00:00
|
|
|
|
2023-06-01 16:44:23 +00:00
|
|
|
# This should fail
|
|
|
|
if [[ ! ("$output" =~ "No input files given") || ($result == 0) ]]
|
|
|
|
then
|
|
|
|
fail "Incorrect response to empty input arg list: $output"
|
|
|
|
fi
|
2021-11-19 13:56:30 +00:00
|
|
|
|
2023-06-01 16:44:23 +00:00
|
|
|
# The contract should be compiled
|
|
|
|
if ! echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --bin | grep -q "<stdin>:C"
|
|
|
|
then
|
|
|
|
fail "Failed to compile a simple contract from standard input"
|
|
|
|
fi
|
2021-11-19 13:56:30 +00:00
|
|
|
|
2023-06-01 16:44:23 +00:00
|
|
|
# This should not fail
|
|
|
|
echo '' | msg_on_error --silent --msg "Incorrect response to --ast-compact-json option with empty stdin" \
|
|
|
|
"$SOLC" --ast-compact-json -
|