2025-09-19 22:27:59 +09:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
|
|
root=$(cd "$(dirname "$0")"/../../../.. && pwd)
|
|
|
|
|
bin="$root/target/release/nyash"
|
2025-09-20 02:20:02 +09:00
|
|
|
src="apps/tests/macro/collections/array_prepend_zero.nyash"
|
2025-09-19 22:27:59 +09:00
|
|
|
|
|
|
|
|
if [ ! -x "$bin" ]; then
|
|
|
|
|
echo "nyash binary not found at $bin; build first (cargo build --release)" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
export NYASH_MACRO_ENABLE=1
|
|
|
|
|
export NYASH_MACRO_PATHS="apps/macros/examples/array_prepend_zero_macro.nyash"
|
|
|
|
|
|
|
|
|
|
export NYASH_USE_NY_COMPILER=1
|
|
|
|
|
export NYASH_VM_USE_PY=1
|
|
|
|
|
export NYASH_CLI_VERBOSE=1
|
|
|
|
|
|
|
|
|
|
out=$("$bin" --backend vm "$src" 2>&1 || true)
|
|
|
|
|
|
|
|
|
|
echo "$out" | rg -q "selfhost macro pre-expand: engaging" && echo "[OK] array pre-expand (auto) engaged" && exit 0
|
|
|
|
|
|
|
|
|
|
echo "[WARN] array pre-expand auto did not engage; printing logs:" >&2
|
|
|
|
|
echo "$out" >&2
|
|
|
|
|
exit 2
|