Codegen: add @qltest.test_with

This allows to group together related AST classes to reuse the same
test source and extraction. For example this is useful for
`EnumDecl/EnumCaseDecl/EnumElementDecl`, where this is applied to.
This commit is contained in:
Paolo Tranquilli
2023-10-23 14:22:26 +02:00
parent 319b799f95
commit 7cc20587ad
26 changed files with 256 additions and 13 deletions

View File

@@ -381,7 +381,8 @@ def generate(opts, renderer):
for c in data.classes.values():
if _should_skip_qltest(c, data.classes):
continue
test_dir = test_out / c.group / c.name
test_with = data.classes[c.test_with] if c.test_with else c
test_dir = test_out / test_with.group / test_with.name
test_dir.mkdir(parents=True, exist_ok=True)
if all(f.suffix in (".txt", ".ql", ".actual", ".expected") for f in test_dir.glob("*.*")):
log.warning(f"no test source in {test_dir.relative_to(test_out)}")