mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
Java: Update the flow test case generator to emit data extension like model data.
This commit is contained in:
@@ -97,12 +97,12 @@ abstract class SupportMethod extends string {
|
||||
int getPriority() { result = 50 }
|
||||
|
||||
/**
|
||||
* Gets the CSV row describing this support method if it is needed to set up the output for this test.
|
||||
* Gets the data extension row describing this support method if it is needed to set up the output for this test.
|
||||
*
|
||||
* For example, `newWithMapValue` will propagate a value from `Argument[0]` to `MapValue of ReturnValue`, and `getMapValue`
|
||||
* For example, `newWithMapValue` will propagate a value from `Argument[0]` to `ReturnValue.MapValue`, and `getMapValue`
|
||||
* will do the opposite.
|
||||
*/
|
||||
string getCsvModel() { none() }
|
||||
string getDataExtensionModel() { none() }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,10 +162,11 @@ private class DefaultGetMethod extends GetMethod {
|
||||
result = "Object get" + contentToken(c) + "Default(Object container) { return null; }"
|
||||
}
|
||||
|
||||
override string getCsvModel() {
|
||||
override string getDataExtensionModel() {
|
||||
result =
|
||||
"generatedtest;Test;false;" + this.getName() + ";(Object);;Argument[0]." +
|
||||
getComponentSpec(SummaryComponent::content(c)) + ";ReturnValue;value;manual"
|
||||
"\"generatedtest\", \"Test\", False, \"" + this.getName() +
|
||||
"\", \"(Object)\", \"\", \"Argument[0]." + getComponentSpec(SummaryComponent::content(c)) +
|
||||
"\", \"ReturnValue\", \"value\", \"manual\""
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,10 +359,11 @@ private class DefaultGenMethod extends GenMethod {
|
||||
result = "Object newWith" + contentToken(c) + "Default(Object element) { return null; }"
|
||||
}
|
||||
|
||||
override string getCsvModel() {
|
||||
override string getDataExtensionModel() {
|
||||
result =
|
||||
"generatedtest;Test;false;" + this.getName() + ";(Object);;Argument[0];ReturnValue." +
|
||||
getComponentSpec(SummaryComponent::content(c)) + ";value;manual"
|
||||
"\"generatedtest\", \"Test\", False, \"" + this.getName() +
|
||||
"\", \"(Object)\", \"\", \"Argument[0]\", \"ReturnValue." +
|
||||
getComponentSpec(SummaryComponent::content(c)) + "\", \"value\", \"manual\""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,12 +85,12 @@ SupportMethod getASupportMethod() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a CSV specification of the taint-/value-propagation behavior of a test support method (`get` or `newWith` method).
|
||||
* Returns a data extension specification of the taint-/value-propagation behavior of a test support method (`get` or `newWith` method).
|
||||
*/
|
||||
query string getASupportMethodModel() { result = getASupportMethod().getCsvModel() }
|
||||
query string getASupportMethodModel() { result = getASupportMethod().getDataExtensionModel() }
|
||||
|
||||
/**
|
||||
* Gets a Java file body testing all requested CSV rows against whatever classes and methods they resolve against.
|
||||
* Gets a Java file body testing all requested Models as Data rows against whatever classes and methods they resolve against.
|
||||
*/
|
||||
query string getTestCase() {
|
||||
result =
|
||||
|
||||
Reference in New Issue
Block a user