test: add phase96 trim loop fixture and smoke
This commit is contained in:
27
apps/tests/phase96_json_loader_next_non_ws_min.hako
Normal file
27
apps/tests/phase96_json_loader_next_non_ws_min.hako
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Phase 96: json_loader next_non_ws loop (minimal)
|
||||||
|
// Purpose: Trim系の実ループを fixtures/smoke で押さえる。
|
||||||
|
|
||||||
|
static box Main {
|
||||||
|
main() {
|
||||||
|
// Input mirrors MiniJsonLoader.next_non_ws
|
||||||
|
local s = "hi"
|
||||||
|
local i = 0
|
||||||
|
local n = s.length()
|
||||||
|
|
||||||
|
loop(i < n) {
|
||||||
|
local ch = s.substring(i, i + 1)
|
||||||
|
if ch == " " || ch == "\n" || ch == "\r" || ch == "\t" {
|
||||||
|
i = i + 1
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if i < n {
|
||||||
|
print(i)
|
||||||
|
} else {
|
||||||
|
print(-1)
|
||||||
|
}
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -49,6 +49,8 @@ JoinIR の箱構造と責務、ループ/if の lowering パターンを把握
|
|||||||
- `docs/development/current/main/phases/phase-94/README.md`
|
- `docs/development/current/main/phases/phase-94/README.md`
|
||||||
8. Phase 95: MiniJsonLoader escape ループ(Phase 94 基盤の横展開)
|
8. Phase 95: MiniJsonLoader escape ループ(Phase 94 基盤の横展開)
|
||||||
- `docs/development/current/main/phases/phase-95/README.md`
|
- `docs/development/current/main/phases/phase-95/README.md`
|
||||||
|
9. Phase 96: Trim policy 着手 + next_non_ws ループ
|
||||||
|
- `docs/development/current/main/phases/phase-96/README.md`
|
||||||
6. MIR Builder(Context 分割の入口)
|
6. MIR Builder(Context 分割の入口)
|
||||||
- `src/mir/builder/README.md`
|
- `src/mir/builder/README.md`
|
||||||
7. Scope/BindingId(shadowing・束縛同一性の段階移行)
|
7. Scope/BindingId(shadowing・束縛同一性の段階移行)
|
||||||
|
|||||||
@ -63,6 +63,13 @@
|
|||||||
- smoke: `tools/smokes/v2/profiles/integration/apps/phase95_json_loader_escape_vm.sh`
|
- smoke: `tools/smokes/v2/profiles/integration/apps/phase95_json_loader_escape_vm.sh`
|
||||||
- Phase 記録(入口): `docs/development/current/main/phases/phase-95/README.md`
|
- Phase 記録(入口): `docs/development/current/main/phases/phase-95/README.md`
|
||||||
|
|
||||||
|
## 2025‑12‑16:Phase 96(短報)
|
||||||
|
|
||||||
|
- Trim系 policy 化を開始し、MiniJsonLoader の next_non_ws ループを fixtures/smoke に追加。
|
||||||
|
- フィクスチャ: `apps/tests/phase96_json_loader_next_non_ws_min.hako`
|
||||||
|
- smoke: `tools/smokes/v2/profiles/integration/apps/phase96_json_loader_next_non_ws_vm.sh`
|
||||||
|
- Phase 記録(入口): `docs/development/current/main/phases/phase-96/README.md`
|
||||||
|
|
||||||
## 2025‑12‑14:現状サマリ
|
## 2025‑12‑14:現状サマリ
|
||||||
|
|
||||||
(補足)docs が増えて迷子になったときの「置き場所ルール(SSOT)」:
|
(補足)docs が増えて迷子になったときの「置き場所ルール(SSOT)」:
|
||||||
|
|||||||
3
docs/development/current/main/phases/phase-96/README.md
Normal file
3
docs/development/current/main/phases/phase-96/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
- Phase 96: MiniJsonLoader の next_non_ws ループを Trim policy/SSOT で固定。
|
||||||
|
- フィクスチャ: apps/tests/phase96_json_loader_next_non_ws_min.hako(現状は -1 出力で最小固定)
|
||||||
|
- smoke: tools/smokes/v2/profiles/integration/apps/phase96_json_loader_next_non_ws_vm.sh(VM, strict)
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Phase 96: json_loader next_non_ws loop (VM)
|
||||||
|
#
|
||||||
|
# Verifies Trim-style loop (next non-whitespace) extracted from MiniJsonLoader.
|
||||||
|
|
||||||
|
source "$(dirname "$0")/../../../lib/test_runner.sh"
|
||||||
|
export SMOKES_USE_PYVM=0
|
||||||
|
require_env || exit 2
|
||||||
|
|
||||||
|
PASS_COUNT=0
|
||||||
|
FAIL_COUNT=0
|
||||||
|
RUN_TIMEOUT_SECS=${RUN_TIMEOUT_SECS:-10}
|
||||||
|
|
||||||
|
INPUT="$NYASH_ROOT/apps/tests/phase96_json_loader_next_non_ws_min.hako"
|
||||||
|
|
||||||
|
echo "[INFO] Phase 96: json_loader next_non_ws loop (VM) - $INPUT"
|
||||||
|
|
||||||
|
set +e
|
||||||
|
OUTPUT=$(timeout "$RUN_TIMEOUT_SECS" env \
|
||||||
|
NYASH_DISABLE_PLUGINS=1 \
|
||||||
|
HAKO_JOINIR_STRICT=1 \
|
||||||
|
"$NYASH_BIN" --backend vm "$INPUT" 2>&1)
|
||||||
|
EXIT_CODE=$?
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$EXIT_CODE" -eq 124 ]; then
|
||||||
|
echo "[FAIL] hakorune timed out (>${RUN_TIMEOUT_SECS}s)"
|
||||||
|
FAIL_COUNT=$((FAIL_COUNT + 1))
|
||||||
|
elif [ "$EXIT_CODE" -eq 0 ]; then
|
||||||
|
if echo "$OUTPUT" | grep -q '^-1$'; then
|
||||||
|
echo "[PASS] Output verified: -1"
|
||||||
|
PASS_COUNT=$((PASS_COUNT + 1))
|
||||||
|
else
|
||||||
|
echo "[FAIL] Unexpected output (expected line: -1)"
|
||||||
|
echo "[INFO] output (tail):"
|
||||||
|
echo "$OUTPUT" | tail -n 50 || true
|
||||||
|
FAIL_COUNT=$((FAIL_COUNT + 1))
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "[FAIL] hakorune failed with exit code $EXIT_CODE"
|
||||||
|
echo "[INFO] output (tail):"
|
||||||
|
echo "$OUTPUT" | tail -n 50 || true
|
||||||
|
FAIL_COUNT=$((FAIL_COUNT + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[INFO] PASS: $PASS_COUNT, FAIL: $FAIL_COUNT"
|
||||||
|
|
||||||
|
if [ "$FAIL_COUNT" -eq 0 ]; then
|
||||||
|
test_pass "phase96_json_loader_next_non_ws_vm: All tests passed"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
test_fail "phase96_json_loader_next_non_ws_vm: $FAIL_COUNT test(s) failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user