54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
"""Prepare test data for Playwright E2E tests."""
|
|
import os
|
|
from pathlib import Path
|
|
|
|
FIXTURES = Path(__file__).parent / "fixtures"
|
|
COBOL_GIT = Path(
|
|
os.environ.get("COBOL_GIT_ROOT",
|
|
Path(__file__).resolve().parent.parent.parent / "jcl-cobol-git")
|
|
)
|
|
|
|
|
|
def prepare():
|
|
results = []
|
|
|
|
# Check simple fixtures
|
|
for f in ["simple.cpy", "simple.cbl", "simple.yaml"]:
|
|
p = FIXTURES / f
|
|
results.append(("OK" if p.exists() else "MISSING", f"fixtures/{f}"))
|
|
|
|
# Create bad COBOL
|
|
bad = FIXTURES / "bad.cbl"
|
|
if not bad.exists():
|
|
src = (FIXTURES / "simple.cbl").read_text()
|
|
bad.write_text(src.replace("STOP RUN.", "THIS_IS_SYNTAX_ERROR"))
|
|
results.append(("CREATED", "fixtures/bad.cbl"))
|
|
else:
|
|
results.append(("OK", "fixtures/bad.cbl"))
|
|
|
|
# Check COBOL system data
|
|
for f in ["member.dat", "rate.dat", "transactions.dat"]:
|
|
p = COBOL_GIT / "data/input" / f
|
|
results.append(("OK" if p.exists() else "MISSING", f"jcl-cobol-git/data/input/{f}"))
|
|
|
|
for f in ["validated_tx.dat"]:
|
|
p = COBOL_GIT / "data/work" / f
|
|
results.append(("OK" if p.exists() else "MISSING", f"jcl-cobol-git/data/work/{f}"))
|
|
|
|
# Check COBOL programs
|
|
for f in ["CRDVAL.cbl", "CRDCALC.cbl"]:
|
|
p = COBOL_GIT / "cobol" / f
|
|
results.append(("OK" if p.exists() else "MISSING", f"jcl-cobol-git/cobol/{f}"))
|
|
|
|
# Check Java
|
|
for f in ["CrdVal.java", "CrdCalc.java"]:
|
|
p = COBOL_GIT / "java/src/main/java/coboljava" / f
|
|
results.append(("OK" if p.exists() else "MISSING", f"jcl-cobol-git/java/{f}"))
|
|
|
|
return results
|
|
|
|
|
|
if __name__ == "__main__":
|
|
for status, name in prepare():
|
|
print(f"[{status:7s}] {name}")
|