test: reject unlisted typecheck fixtures
This commit is contained in:
@@ -2,6 +2,11 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Reject unlisted typecheck fixtures
|
||||||
|
|
||||||
|
- `tools/validate_typecheck_diagnostics.py` now discovers `tests/typecheck_*.claro` files and fails when a fixture is missing from the validator's positive or negative lists.
|
||||||
|
- This keeps new learner-facing typecheck examples from silently escaping release validation.
|
||||||
|
|
||||||
### Explain text operands in object-field addition
|
### Explain text operands in object-field addition
|
||||||
|
|
||||||
- Added focused typecheck coverage for `SET player.score player.name + 1`.
|
- Added focused typecheck coverage for `SET player.score player.name + 1`.
|
||||||
|
|||||||
@@ -205,6 +205,23 @@ STALE_PHRASES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def validate_fixture_coverage():
|
||||||
|
discovered = {
|
||||||
|
path.relative_to(ROOT).as_posix()
|
||||||
|
for path in (ROOT / "tests").glob("typecheck_*.claro")
|
||||||
|
}
|
||||||
|
listed = set(EXPECTED) | set(EXPECTED_OK)
|
||||||
|
missing = sorted(discovered - listed)
|
||||||
|
extra = sorted(listed - discovered - {"tests/37_object_field_types.claro"})
|
||||||
|
if missing or extra:
|
||||||
|
details = []
|
||||||
|
if missing:
|
||||||
|
details.append("unlisted fixtures: " + ", ".join(missing))
|
||||||
|
if extra:
|
||||||
|
details.append("missing fixture files: " + ", ".join(extra))
|
||||||
|
raise SystemExit("Typecheck fixture coverage mismatch: " + "; ".join(details))
|
||||||
|
|
||||||
|
|
||||||
def run_typecheck(path):
|
def run_typecheck(path):
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
[str(EXE), "typecheck", path],
|
[str(EXE), "typecheck", path],
|
||||||
@@ -251,6 +268,7 @@ def main():
|
|||||||
if not EXE.exists():
|
if not EXE.exists():
|
||||||
raise SystemExit(f"Missing Claro executable: {EXE}")
|
raise SystemExit(f"Missing Claro executable: {EXE}")
|
||||||
|
|
||||||
|
validate_fixture_coverage()
|
||||||
for path in EXPECTED:
|
for path in EXPECTED:
|
||||||
run_typecheck(path)
|
run_typecheck(path)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user