mirror of
https://github.com/github/codeql.git
synced 2026-05-03 04:39:29 +02:00
Only include support methods and imports from working test cases
This commit is contained in:
@@ -57,12 +57,17 @@ query string noTestCaseGenerated() {
|
||||
not exists(any(TestCase tc).getATestSnippetForRow(result))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a valid test case, i.e. one that has a test snippet.
|
||||
*/
|
||||
TestCase getAValidTestCase() { exists(result.getATestSnippetForRow(_)) }
|
||||
|
||||
/**
|
||||
* Returns an import statement to include in the test case header.
|
||||
*/
|
||||
string getAnImportStatement() {
|
||||
exists(RefType t |
|
||||
t = any(TestCase tc).getADesiredImport() and
|
||||
t = getAValidTestCase().getADesiredImport() and
|
||||
isImportable(t) and
|
||||
t.getPackage().getName() != "java.lang"
|
||||
|
|
||||
@@ -76,7 +81,7 @@ string getAnImportStatement() {
|
||||
SupportMethod getASupportMethod() {
|
||||
result instanceof SourceMethod or
|
||||
result instanceof SinkMethod or
|
||||
result = any(TestCase tc).getASupportMethod()
|
||||
result = getAValidTestCase().getASupportMethod()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user