Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit d5c8570

Browse files
author
Max Schaefer
committed
Recognise imports of well-known testing frameworks.
1 parent e30e568 commit d5c8570

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

ql/src/semmle/go/frameworks/Testing.qll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,19 @@ module TestFile {
6767
private class FileContainingTestCases extends Range {
6868
FileContainingTestCases() { this = any(TestCase tc).getFile() }
6969
}
70+
71+
/** A file that imports a well-known testing framework. */
72+
private class FileImportingTestingFramework extends Range {
73+
FileImportingTestingFramework() {
74+
exists(string pkg, ImportSpec is |
75+
is.getPath() = pkg and
76+
is.getFile() = this
77+
|
78+
pkg = "net/http/httptest" or
79+
pkg = "gen/thrifttest" or
80+
pkg = "github.com/onsi/ginkgo" or
81+
pkg = "github.com/onsi/gomega"
82+
)
83+
}
84+
}
7085
}

0 commit comments

Comments
 (0)