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-linking-XXXXXX")
|
2023-06-01 16:44:23 +00:00
|
|
|
cd "$SOLTMPDIR"
|
|
|
|
|
|
|
|
echo 'library L { function f() public pure {} } contract C { function f() public pure { L.f(); } }' > x.sol
|
|
|
|
msg_on_error --no-stderr "$SOLC" --bin -o . x.sol
|
|
|
|
|
|
|
|
# Explanation and placeholder should be there
|
|
|
|
grep -q '//' C.bin && grep -q '__' C.bin
|
|
|
|
|
|
|
|
# But not in library file.
|
|
|
|
grep -q -v '[/_]' L.bin
|
|
|
|
|
|
|
|
# Now link
|
2023-06-01 18:10:42 +00:00
|
|
|
printf " "
|
2023-06-01 16:44:23 +00:00
|
|
|
msg_on_error "$SOLC" --link --libraries x.sol:L=0x90f20564390eAe531E810af625A22f51385Cd222 C.bin
|
|
|
|
|
|
|
|
# Now the placeholder and explanation should be gone.
|
|
|
|
grep -q -v '[/_]' C.bin
|
|
|
|
|
2021-11-19 13:56:30 +00:00
|
|
|
rm -r "$SOLTMPDIR"
|