You've already forked RecordFlux-parser
mirror of
https://github.com/AdaCore/RecordFlux-parser.git
synced 2026-02-12 13:09:26 -08:00
24 lines
665 B
Python
24 lines
665 B
Python
from pathlib import Path
|
|
|
|
import librflxlang
|
|
import pytest
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"spec",
|
|
[*(Path("tests") / "data").rglob("*.rflx")]
|
|
+ [*(Path("contrib") / "RecordFlux-specifications").rglob("*.rflx")],
|
|
)
|
|
def test_file(spec: Path) -> None:
|
|
ctx = librflxlang.AnalysisContext()
|
|
unit = ctx.get_from_file(str(spec))
|
|
del ctx
|
|
if spec.name.startswith("incorrect_"):
|
|
assert len(unit.diagnostics) > 0, f"{spec}"
|
|
else:
|
|
assert len(unit.diagnostics) == 0, f"{spec}: " + "\n".join(
|
|
f"{spec}:{d}" for d in unit.diagnostics
|
|
)
|
|
if unit.root:
|
|
assert unit.root.kind_name == "Specification"
|