Files
root 6f59181f09 Rename dynamic dval to any and add port spawn options
Keep the compile-time generic marker as *. Update the compiler, stdlib,
fixtures, documentation and editor grammars without a dynamic type alias.
Preserve native identifiers and historical work and patch records.

Replace the port_spawn environment argument with cwd/env options. Report
failed directory changes through EXIT 127 with cwd_failed.

Compile every API example and add a complete Pi RPC service example.
Service examples compile without execution or output blocks. Update ABI
versions and audited golden artifacts.
2026-10-15 02:50:33 +00:00

42 lines
1.9 KiB
Python

#!/usr/bin/env python3
import json
import subprocess
from pathlib import Path
root = Path(__file__).resolve().parents[1]
expected = json.loads((root / "scripts/dval_live_expected.json").read_text())
for name, output in expected.items():
result = subprocess.run(
["timeout", "30", "scripts/bearer-cli", "/tests/" + name + ".capy"],
cwd=root, text=True, capture_output=True, timeout=35,
)
assert result.returncode == 0, (name, result.stdout, result.stderr)
assert result.stdout == output, (name, output, result.stdout)
print("PASS", name)
for name in ["capy-any-assign-list-trap", "capy-any-callable-signature-trap"]:
result = subprocess.run(
["timeout", "30", "scripts/bearer-cli", "/tests/" + name + ".capy"],
cwd=root, text=True, capture_output=True, timeout=35,
)
assert result.returncode != 0, (name, result.stdout)
assert "trap" in (result.stdout + result.stderr).lower(), (name, result.stdout)
print("PASS", name, "trap")
result = subprocess.run(
["curl", "-fsS", "--max-time", "30", "-D", "-", "-H", "Host: bearer.openfu.com",
"-d", "value=form", "http://127.0.0.1/tests/capy-request-writeback.capy?value=query"],
cwd=root, text=True, capture_output=True, timeout=35,
)
assert result.returncode == 0, result.stderr
headers, body = result.stdout.split("\n\n", 1)
assert body == "form|Ada|404|pending|0|component|inner|2", body
assert headers.splitlines()[0].split()[1] == "203", headers
assert "x-capy-phase5: inner" in headers.lower(), headers
assert "x-capy-parent: pending" in headers.lower(), headers
print("PASS shared request and nested response")
result = subprocess.run(
["timeout", "30", "scripts/bearer-cli", "/tests/capy-any-none.capy"],
cwd=root, text=True, capture_output=True, timeout=35,
)
assert result.returncode == 0 and result.stdout == expected["capy-any-none"], result.stdout
print("PASS trap recovery")