#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")"/.. && pwd)
BIN="$ROOT_DIR/target/release/hakorune"

if [[ ! -x "$BIN" ]]; then
  (cd "$ROOT_DIR" && cargo build --release >/dev/null)
fi

run() {
  NYASH_VM_USE_PY=1 NYASH_SYNTAX_SUGAR_LEVEL=full NYASH_ENABLE_MAP_LITERAL=1 "$BIN" --backend vm "$ROOT_DIR/apps/tests/map_literal_ident_key.hako" 2>&1
}

OUT=$(run || true)
echo "$OUT" | rg -q '^2$' && echo "$OUT" | rg -q '^A$' \
  && echo "✅ PyVM: map literal ident-key" || { echo "❌ PyVM: map literal ident-key"; echo "$OUT"; exit 1; }

echo "Map literal ident-key smoke PASS" >&2

