Skip to content

Commit cd0d09d

Browse files
committed
Java: Refactor to avoid using SummaryModelCsv.
1 parent d2c458c commit cd0d09d

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

java/ql/src/utils/flowtestcasegenerator/FlowTestCase.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ private import FlowTestCaseSupportMethods
1212

1313
/**
1414
* A CSV row to generate tests for. Users should extend this to define which
15-
* tests to generate. Rows specified here should also satisfy `SummaryModelCsv.row`.
15+
* tests to generate. There should already exist a summaries for the rows specified here.
1616
*/
1717
class TargetSummaryModelCsv extends Unit {
1818
/**
@@ -44,7 +44,7 @@ predicate summaryModelRow(
4444
/**
4545
* Gets a CSV row for which a test has been requested, but where a summary has not already been defined.
4646
*/
47-
query string missingSummaryModelCsv() {
47+
query string missingSummaryModel() {
4848
any(TargetSummaryModelCsv target).row(result) and
4949
not summaryModelRow(_, _, _, _, _, _, _, _, _, _, result)
5050
}

java/ql/src/utils/flowtestcasegenerator/GenerateFlowTestCase.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ def getTuples(queryName, jsonResult, fname):
173173
with open(generatedJson, "r") as f:
174174
generateOutput = json.load(f)
175175
expectedTables = ("getTestCase", "getASupportMethodModel",
176-
"missingSummaryModelCsv", "getAParseFailure", "noTestCaseGenerated")
176+
"missingSummaryModel", "getAParseFailure", "noTestCaseGenerated")
177177

178-
testCaseRows, supportModelRows, missingSummaryModelCsvRows, parseFailureRows, noTestCaseGeneratedRows = \
178+
testCaseRows, supportModelRows, missingSummaryModelRows, parseFailureRows, noTestCaseGeneratedRows = \
179179
tuple([getTuples(k, generateOutput, generatedJson)
180180
for k in expectedTables])
181181

@@ -192,9 +192,9 @@ def getTuples(queryName, jsonResult, fname):
192192
print("Expected exactly one column in noTestCaseGenerated relation (got: %s)" %
193193
json.dumps(noTestCaseGeneratedRows), file=sys.stderr)
194194

195-
if len(missingSummaryModelCsvRows) != 0:
196-
print("Tests for some CSV rows were requested that were not in scope (SummaryModelCsv.row does not hold):\n" +
197-
"\n".join(r[0] for r in missingSummaryModelCsvRows))
195+
if len(missingSummaryModelRows) != 0:
196+
print("Tests for some CSV rows were requested that were not in scope (a summary doesn't already exist):\n" +
197+
"\n".join(r[0] for r in missingSummaryModelRows))
198198
sys.exit(1)
199199
if len(parseFailureRows) != 0:
200200
print("The following rows failed to generate any test case. Check package, class and method name spelling, and argument and result specifications:\n%s" %

java/ql/src/utils/flowtestcasegenerator/GenerateFlowTestCase.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ private import FlowTestCaseSupportMethods
1313
private import FlowTestCaseUtils
1414

1515
/**
16-
* Gets a CSV row for which a test has been requested, and `SummaryModelCsv.row` does hold, but
16+
* Gets a CSV row for which a test has been requested, and where there exist a summary, but
1717
* nonetheless we can't generate a test case for it, indicating we cannot resolve either the callable
1818
* spec or an input or output spec.
1919
*/
2020
query string getAParseFailure(string reason) {
2121
any(TargetSummaryModelCsv target).row(result) and
22-
any(SummaryModelCsv model).row(result) and
22+
summaryModelRow(_, _, _, _, _, _, _, _, _, _, result) and
2323
(
2424
not summaryModelRow(_, _, _, _, _, _, _, _, _, _, result) and
2525
reason = "row could not be parsed"
@@ -52,7 +52,7 @@ query string getAParseFailure(string reason) {
5252
*/
5353
query string noTestCaseGenerated() {
5454
any(TargetSummaryModelCsv target).row(result) and
55-
any(SummaryModelCsv model).row(result) and
55+
summaryModelRow(_, _, _, _, _, _, _, _, _, _, result) and
5656
not exists(getAParseFailure(_)) and
5757
not exists(any(TestCase tc).getATestSnippetForRow(result))
5858
}

0 commit comments

Comments
 (0)