Switch to an abstract unit / predicate approach to specifying rows to generate tests for

This enables moving this code into the qll file, rather than having to specify a query predicate in the .ql
This commit is contained in:
Chris Smowton
2021-06-21 20:07:34 +01:00
parent f3868887b8
commit bd1bd8cf08
2 changed files with 10 additions and 7 deletions

View File

@@ -112,7 +112,7 @@ qlFile = os.path.join(queryDir, "gen.ql")
with open(os.path.join(queryDir, "qlpack.yml"), "w") as f:
f.write("name: test-generation-query\nversion: 0.0.0\nlibraryPathDependencies: codeql-java")
with open(qlFile, "w") as f:
f.write("import java\nimport utils.GenerateFlowTestCase\n\nclass GenRow extends CsvRow {\n\n\tGenRow() {\n\t\tthis = [\n")
f.write("import java\nimport utils.GenerateFlowTestCase\n\nclass GenRow extends TargetSummaryModelCsv {\n\n\toverride predicate row(string r) {\n\t\tr = [\n")
f.write(",\n".join('\t\t\t"%s"' % spec.strip() for spec in specs))
f.write("\n\t\t]\n\t}\n}\n")