mirror of
https://github.com/AdaCore/langkit.git
synced 2026-02-12 12:28:12 -08:00
All tests which just check the presence/absence of errors when compiling Lkt language specs have the same "test.py" script: put a reference script in "python_support", create a new test driver to let tests use it easily and migrate relevant tests to it. For GitHub issue #622
41 lines
876 B
Python
41 lines
876 B
Python
"""
|
|
Test script to compile all Lkt sources in the current directory up to code
|
|
emission and to print error messages.
|
|
"""
|
|
|
|
import argparse
|
|
import glob
|
|
|
|
import langkit
|
|
|
|
from utils import emit_and_print_errors
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument(
|
|
"--generate-unparser",
|
|
action="store_true",
|
|
help="Enable the generation of the unparser",
|
|
)
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
# Compile all *.lkt" file except the ones starting with "common", as they
|
|
# contain just common code for the other sources, but are not compilable alone.
|
|
tests = [f for f in glob.glob("*.lkt") if not f.startswith("common")]
|
|
|
|
|
|
for lkt_file in sorted(tests):
|
|
print(f"== {lkt_file} ==")
|
|
emit_and_print_errors(
|
|
lkt_file=lkt_file,
|
|
types_from_lkt=True,
|
|
generate_unparser=args.generate_unparser,
|
|
)
|
|
langkit.reset()
|
|
print("")
|
|
|
|
print("Done")
|