mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
Test: Handle 'problems' result set as an alias for '#select'
This commit is contained in:
@@ -583,6 +583,9 @@ private string expectationPattern() {
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets the string `#select` or `problems`, which are equivalent result sets for a `problem` or `path-problem` query. */
|
||||
private string mainResultSet() { result = ["#select", "problems"] }
|
||||
|
||||
/**
|
||||
* Provides logic for creating a `@kind test-postprocess` query that checks
|
||||
* inline test expectations using `$ Alert` markers.
|
||||
@@ -650,8 +653,8 @@ module TestPostProcessing {
|
||||
*/
|
||||
private string getSourceTag(int row) {
|
||||
getQueryKind() = "path-problem" and
|
||||
exists(string loc | queryResults("#select", row, 2, loc) |
|
||||
if queryResults("#select", row, 0, loc) then result = "Alert" else result = "Source"
|
||||
exists(string loc | queryResults(mainResultSet(), row, 2, loc) |
|
||||
if queryResults(mainResultSet(), row, 0, loc) then result = "Alert" else result = "Source"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -663,8 +666,8 @@ module TestPostProcessing {
|
||||
*/
|
||||
private string getSinkTag(int row) {
|
||||
getQueryKind() = "path-problem" and
|
||||
exists(string loc | queryResults("#select", row, 4, loc) |
|
||||
if queryResults("#select", row, 0, loc) then result = "Alert" else result = "Sink"
|
||||
exists(string loc | queryResults(mainResultSet(), row, 4, loc) |
|
||||
if queryResults(mainResultSet(), row, 0, loc) then result = "Alert" else result = "Sink"
|
||||
)
|
||||
}
|
||||
|
||||
@@ -717,8 +720,8 @@ module TestPostProcessing {
|
||||
) {
|
||||
getQueryKind() = "path-problem" and
|
||||
exists(string loc |
|
||||
queryResults("#select", row, 2, loc) and
|
||||
queryResults("#select", row, 3, element) and
|
||||
queryResults(mainResultSet(), row, 2, loc) and
|
||||
queryResults(mainResultSet(), row, 3, element) and
|
||||
tag = getSourceTag(row) and
|
||||
value = "" and
|
||||
Input2::getRelativeUrl(location) = loc
|
||||
@@ -757,8 +760,8 @@ module TestPostProcessing {
|
||||
) {
|
||||
getQueryKind() = "path-problem" and
|
||||
exists(string loc |
|
||||
queryResults("#select", row, 4, loc) and
|
||||
queryResults("#select", row, 5, element) and
|
||||
queryResults(mainResultSet(), row, 4, loc) and
|
||||
queryResults(mainResultSet(), row, 5, element) and
|
||||
tag = getSinkTag(row) and
|
||||
Input2::getRelativeUrl(location) = loc
|
||||
)
|
||||
@@ -767,8 +770,8 @@ module TestPostProcessing {
|
||||
private predicate hasAlert(int row, Input::Location location, string element, string tag) {
|
||||
getQueryKind() = ["problem", "path-problem"] and
|
||||
exists(string loc |
|
||||
queryResults("#select", row, 0, loc) and
|
||||
queryResults("#select", row, 2, element) and
|
||||
queryResults(mainResultSet(), row, 0, loc) and
|
||||
queryResults(mainResultSet(), row, 2, element) and
|
||||
tag = "Alert" and
|
||||
Input2::getRelativeUrl(location) = loc and
|
||||
not hasPathProblemSource(row, location, _, _, _) and
|
||||
|
||||
Reference in New Issue
Block a user