isTestFunc returns true for func TestXxx(t *testing.T).
(fn *ast.FuncDecl)
| 118 | |
| 119 | // isTestFunc returns true for func TestXxx(t *testing.T). |
| 120 | func isTestFunc(fn *ast.FuncDecl) bool { |
| 121 | if fn.Recv != nil { |
| 122 | return false // method, not a function |
| 123 | } |
| 124 | if !strings.HasPrefix(fn.Name.Name, "Test") { |
| 125 | return false |
| 126 | } |
| 127 | if fn.Body == nil { |
| 128 | return false |
| 129 | } |
| 130 | return testingTParamName(fn) != "" |
| 131 | } |
| 132 | |
| 133 | // testingTParamName returns the name of the *testing.T parameter, or "" if not found. |
| 134 | func testingTParamName(fn *ast.FuncDecl) string { |
no test coverage detected