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:51:42 +00:00
|
|
|
SOLTMPDIR=$(mktemp -d -t "cmdline-test-overwriting-files-XXXXXX")
|
2023-06-01 16:44:23 +00:00
|
|
|
|
|
|
|
# First time it works
|
|
|
|
echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create"
|
|
|
|
|
|
|
|
# Second time it fails
|
|
|
|
echo 'contract C {}' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null && \
|
|
|
|
fail "solc did not refuse to overwrite $SOLTMPDIR/non-existing-stuff-to-create."
|
|
|
|
|
|
|
|
# Unless we force
|
|
|
|
echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --overwrite --bin -o "$SOLTMPDIR/non-existing-stuff-to-create"
|
|
|
|
|
2021-11-19 13:56:30 +00:00
|
|
|
rm -r "$SOLTMPDIR"
|