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

Commit e30e568

Browse files
author
Max Schaefer
committed
Fix recognition of Test, Benchmark, and Example as test cases.
1 parent be9e972 commit e30e568

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ module TestCase {
2727
/** A `go test` style test (including benchmarks and examples). */
2828
private class GoTestFunction extends Range, FuncDef {
2929
GoTestFunction() {
30-
getName().regexpMatch("Test[^a-z].*") and
30+
getName().regexpMatch("Test(?![a-z]).*") and
3131
getNumParameter() = 1 and
3232
getParameter(0).getType().(PointerType).getBaseType().hasQualifiedName("testing", "T")
3333
or
34-
getName().regexpMatch("Benchmark[^a-z].*") and
34+
getName().regexpMatch("Benchmark(?![a-z]).*") and
3535
getNumParameter() = 1 and
3636
getParameter(0).getType().(PointerType).getBaseType().hasQualifiedName("testing", "B")
3737
or
38-
getName().regexpMatch("Example[^a-z].*") and
38+
getName().regexpMatch("Example(?![a-z]).*") and
3939
getNumParameter() = 0
4040
}
4141
}

0 commit comments

Comments
 (0)