-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheckers_httptest.go
36 lines (32 loc) · 956 Bytes
/
checkers_httptest.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package mirror
import "github.com/butuzov/mirror/internal/checker"
var HTTPTestMethods = []checker.Violation{
{ // (*net/http/httptest.ResponseRecorder).Write
Targets: checker.Bytes,
Type: checker.Method,
Package: "net/http/httptest",
Struct: "ResponseRecorder",
Caller: "Write",
Args: []int{0},
AltCaller: "WriteString",
Generate: &checker.Generate{
PreCondition: `h := httptest.ResponseRecorder{}`,
Pattern: `Write($0)`,
Returns: []string{"int", "error"},
},
},
{ // (*net/http/httptest.ResponseRecorder).WriteString
Targets: checker.Strings,
Type: checker.Method,
Package: "net/http/httptest",
Struct: "ResponseRecorder",
Caller: "WriteString",
Args: []int{0},
AltCaller: "Write",
Generate: &checker.Generate{
PreCondition: `h := httptest.ResponseRecorder{}`,
Pattern: `WriteString($0)`,
Returns: []string{"int", "error"},
},
},
}