2024-01-06 23:30:35 +03:00
|
|
|
. ../../testutils.sh
|
|
|
|
|
|
|
|
idris2 --cg node -o node_executable TestExecutable.idr > /dev/null
|
|
|
|
|
2024-01-07 00:22:12 +03:00
|
|
|
# node still executes it:
|
2024-01-06 23:30:35 +03:00
|
|
|
node ./build/exec/node_executable
|
|
|
|
|
2024-01-07 00:22:12 +03:00
|
|
|
# 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
|