mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-20 18:21:47 +03:00
20 lines
745 B
Plaintext
20 lines
745 B
Plaintext
. ../../testutils.sh
|
|
|
|
idris2 --cg node -o node_executable TestExecutable.idr > /dev/null
|
|
|
|
# node still executes it:
|
|
node ./build/exec/node_executable
|
|
|
|
# it can be executed on its own due to shebang and executable bit:
|
|
# (/usr/bin/env as used in shebang is problematic in edge cases
|
|
# but still generally a good bet; we will make sure the test works
|
|
# even when /usr/bin/env cannot be used)
|
|
fallback () {
|
|
nodejs="$(command -v node)"
|
|
# cross-platform supported sed-ing (unlike with in-place option)
|
|
cp ./build/exec/node_executable ./build/exec/node_executable_src
|
|
sed "s#/usr/bin/env node#$nodejs#" ./build/exec/node_executable_src > ./build/exec/node_executable
|
|
./build/exec/node_executable
|
|
}
|
|
./build/exec/node_executable || fallback
|