You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will validate that first letter after FuzzFoo() should be uppercase
Also, following validation will be performed for f.Fuzz() calls :
1. f.Fuzz() should call a function and it should be of type (*testing.F).Fuzz().
2. The called function in f.Fuzz(func(){}) should not return result.
3. First argument of func() should be of type *testing.T
4. Second argument onwards should be of type []byte, string, bool, byte,
rune, float32, float64, int, int8, int16, int32, int64, uint, uint8, uint16,
uint32, uint64
For golang/go#50198
Change-Id: I540daf635f0fe03d954b010b9b5f8616fd5df47a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/374495
Reviewed-by: Robert Findley <[email protected]>
Trust: Peter Weinberger <[email protected]>
funcFuzzfoo(*testing.F) {} // want "first letter after 'Fuzz' must not be lowercase"
11
+
12
+
funcFuzzBoo(*testing.F) {} // OK because first letter after 'Fuzz' is Uppercase.
13
+
14
+
funcFuzzCallDifferentFunc(f*testing.F) {
15
+
f.Name() //OK
16
+
}
17
+
18
+
funcFuzzFunc(f*testing.F) {
19
+
f.Fuzz(func(t*testing.T) {}) // OK "first argument is of type *testing.T"
20
+
}
21
+
22
+
funcFuzzFuncWithArgs(f*testing.F) {
23
+
f.Fuzz(func(t*testing.T, iint, b []byte) {}) // OK "arguments in func are allowed"
24
+
}
25
+
26
+
funcFuzzArgFunc(f*testing.F) {
27
+
f.Fuzz(0) // want "argument to Fuzz must be a function"
28
+
}
29
+
30
+
funcFuzzFuncWithReturn(f*testing.F) {
31
+
f.Fuzz(func(t*testing.T) bool { returntrue }) // want "fuzz target must not return any value"
32
+
}
33
+
34
+
funcFuzzFuncNoArg(f*testing.F) {
35
+
f.Fuzz(func() {}) // want "fuzz target must have 1 or more argument"
36
+
}
37
+
38
+
funcFuzzFuncFirstArgNotTesting(f*testing.F) {
39
+
f.Fuzz(func(iint64) {}) // want "the first parameter of a fuzz target must be \\*testing.T"
40
+
}
41
+
42
+
funcFuzzFuncFirstArgTestingNotT(f*testing.F) {
43
+
f.Fuzz(func(t*testing.F) {}) // want "the first parameter of a fuzz target must be \\*testing.T"
44
+
}
45
+
46
+
funcFuzzFuncSecondArgNotAllowed(f*testing.F) {
47
+
f.Fuzz(func(t*testing.T, icomplex64) {}) // want "fuzzing arguments can only have the following types: string, bool, float32, float64, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, \\[\\]byte"
48
+
}
49
+
50
+
funcFuzzFuncSecondArgArrNotAllowed(f*testing.F) {
51
+
f.Fuzz(func(t*testing.T, i []int) {}) // want "fuzzing arguments can only have the following types: string, bool, float32, float64, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, \\[\\]byte"
0 commit comments