Documentation
¶
Index ¶
- func ChooseTypes(results []Result, firstOnly bool) []string
- func ConvertSeedsToGoTests(seedsDir, outDir, jsonPath, funcName string) (int, error)
- func LoadTypesFromJSONFile(path, funcName string) ([]string, error)
- func MakeEmptyFuzzFunc(paramTypes []string) (reflect.Value, error)
- func MergeFuncTypesIntoJSON(jsonOut, funcName string, types []string) error
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChooseTypes ¶
ChooseTypes selects which types list to persist when multiple f.Fuzz calls exist. If firstOnly is true, it returns the first. Otherwise it prefers a unanimous list; if they differ, it still returns the first and leaves it to the caller to warn/log.
func ConvertSeedsToGoTests ¶
ConvertSeedsToGoTests:
- loads types for funcName from jsonPath,
- builds an empty fuzz func: func(t *testing.T, ...types) {},
- for each file in seedsDir, calls Source.CreateGoTestcase with the empty func,
- writes the generated Go file to outDir, named as <md5(content)>.go.
Returns number of files written.
func LoadTypesFromJSONFile ¶
LoadTypesFromJSONFile returns the type list for funcName from a JSON map.
func MakeEmptyFuzzFunc ¶
MakeEmptyFuzzFunc constructs a reflect-made no-op function with signature:
func(t *testing.T, <types...>) {}
It returns a reflect.Value holding the function, suitable to pass to input.Source.CreateGoTestcase.
func MergeFuncTypesIntoJSON ¶
MergeFuncTypesIntoJSON loads (or creates) jsonOut and adds funcName -> types if the key doesn't already exist. If the key exists and matches, it's a no-op. If the key exists with different types, it does not overwrite (no-op), by design.
Types ¶
type Result ¶
type Result struct {
Line int // 1-based line number of the f.Fuzz call's '('
Types []string // extracted types in call order, e.g. []{"[]byte","int","int","bool"}
}
Result holds one matched f.Fuzz(...) call found inside the requested function.
func AnalyzeFile ¶
AnalyzeFile parses a single .go file and extracts fuzz arg types from f.Fuzz(...) calls inside function funcName, ensuring the receiver is a *testing.F.