Skip to content

Commit ef5bf87

Browse files
[Test gen] Distinguish default support methods
1 parent eb45e67 commit ef5bf87

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

java/ql/src/utils/FlowTestCase.qll

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,15 @@ class TestCase extends TTestCase {
257257
if componentStack = baseOutput
258258
then result = "out"
259259
else
260-
result =
261-
SupportMethod::getMethodForContent(componentStack)
262-
.getCall(this.getOutput(componentStack.tail()))
260+
if componentStack.tail() = baseOutput
261+
then
262+
result =
263+
SupportMethod::getMethodFor(this.getOutputType(), componentStack)
264+
.getCall(this.getOutput(componentStack.tail()))
265+
else
266+
result =
267+
SupportMethod::getMethodForContent(componentStack)
268+
.getCall(this.getOutput(componentStack.tail()))
263269
)
264270
}
265271

java/ql/src/utils/FlowTestCaseSupportMethods.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private class DefaultGetMethod extends GetMethod {
145145

146146
DefaultGetMethod() { this = "DefaultGet" + contentToken(c) }
147147

148-
string getName() { result = "get" + contentToken(c) }
148+
string getName() { result = "get" + contentToken(c) + "Default" }
149149

150150
override int getPriority() { result = 999 }
151151

@@ -159,12 +159,12 @@ private class DefaultGetMethod extends GetMethod {
159159
override string getCall(string arg) { result = this.getName() + "(" + arg + ")" }
160160

161161
override string getDefinition() {
162-
result = "Object get" + contentToken(c) + "(Object container) { return null; }"
162+
result = "Object get" + contentToken(c) + "Default(Object container) { return null; }"
163163
}
164164

165165
override string getCsvModel() {
166166
result =
167-
"generatedtest;Test;false;" + this.getName() + ";;;" +
167+
"generatedtest;Test;false;" + this.getName() + ";(Object);;" +
168168
getComponentSpec(SummaryComponent::content(c)) + " of Argument[0];ReturnValue;value"
169169
}
170170
}
@@ -285,7 +285,7 @@ private class DefaultGenMethod extends GenMethod {
285285

286286
DefaultGenMethod() { this = "DefaultGen" + contentToken(c) }
287287

288-
string getName() { result = "newWith" + contentToken(c) }
288+
string getName() { result = "newWith" + contentToken(c) + "Default" }
289289

290290
override int getPriority() { result = 999 }
291291

@@ -299,12 +299,12 @@ private class DefaultGenMethod extends GenMethod {
299299
override string getCall(string arg) { result = this.getName() + "(" + arg + ")" }
300300

301301
override string getDefinition() {
302-
result = "Object newWith" + contentToken(c) + "(Object element) { return null; }"
302+
result = "Object newWith" + contentToken(c) + "Default(Object element) { return null; }"
303303
}
304304

305305
override string getCsvModel() {
306306
result =
307-
"generatedtest;Test;false;" + this.getName() + ";;;Argument[0];" +
307+
"generatedtest;Test;false;" + this.getName() + ";(Object);;Argument[0];" +
308308
getComponentSpec(SummaryComponent::content(c)) + " of ReturnValue;value"
309309
}
310310
}

0 commit comments

Comments
 (0)