Documentation
¶
Index ¶
- Variables
- func CreateEmmiter() (*bytes.Buffer, func(format string, args ...interface{}))
- func GenerateFabrics(targets []*Func, typeContext *TypeContext, qualifier *ImportQualifier, ...) map[string][]*GeneratedFunc
- type Constructor
- type Func
- type GeneratedFunc
- type ImportQualifier
- type Interface
- type Package
- type Struct
- type TypeContext
- type VariablesContext
Constants ¶
This section is empty.
Variables ¶
View Source
var Index int = 0
Functions ¶
func CreateEmmiter ¶ added in v0.1.35
func GenerateFabrics ¶
func GenerateFabrics( targets []*Func, typeContext *TypeContext, qualifier *ImportQualifier, maxDepth int, ) map[string][]*GeneratedFunc
Types ¶
type Constructor ¶
type Func ¶
type Func struct {
FuncName string
PkgName string // package name (should be the same as the package's package statement)
PkgPath string // import path
PkgDir string // local on-disk directory
TypesFunc *types.Func // auxiliary information about a Func from the go/types package
AstFuncDecl *ast.FuncDecl // ast func declaration
Uses []*ast.FuncDecl
}
Func represents a discovered function that will be fuzzed.
func (*Func) FuzzName ¶
FuzzName returns the '<pkg>.<OrigFuzzFunc>' string. For example, it might be 'fmt.FuzzFmt'. In fzgo, this was used in messages, and as part of the path when creating the corpus location under testdata.
func (*Func) GetSignature ¶
type GeneratedFunc ¶
func GenerateInitTestFunc ¶
func GenerateInitTestFunc( generatedFuncs map[string][]*GeneratedFunc, typeContext *TypeContext, qualifier *ImportQualifier, ) *GeneratedFunc
func GenerateMockFabrics ¶ added in v0.1.9
func GenerateMockFabrics( targets []*Func, typeContext *TypeContext, qualifier *ImportQualifier, relativePackagePath string, maxDepth int, ) ([]*GeneratedFunc, []byte)
type ImportQualifier ¶
func NewQualifier ¶
func NewQualifier(pkgName, pkgPath, outPkgName, outPkgPath string, isLocalTest bool) *ImportQualifier
func (*ImportQualifier) AddImport ¶ added in v0.1.9
func (iq *ImportQualifier) AddImport(defaultName, path string) string
func (*ImportQualifier) GetImportStrings ¶
func (iq *ImportQualifier) GetImportStrings() []string
type Interface ¶
type Interface struct {
InterfaceName string
PkgName string // package name (should be the same as the package's package statement)
PkgPath string // import path
PkgDir string // local on-disk directory
TypesInterface *types.Interface // auxiliary information about a Interface from the go/types package
TypesNamed *types.Named // auxiliary information about a Named from the go/types package
Implementations []*Struct // structs that implements this interface from explore packages
Constructors []*Constructor
}
func (*Interface) IsSupported ¶
type Struct ¶
type Struct struct {
StructName string
PkgName string // package name (should be the same as the package's package statement)
PkgPath string // import path
PkgDir string // local on-disk directory
TypesStruct *types.Struct // auxiliary information about a Struct from the go/types package
TypesNamed *types.Named // auxiliary information about a Named from the go/types package
Constructors []*Constructor
AsPointer bool // detect that struct implement interface as pointer to this struct
}
type TypeContext ¶
type TypeContext struct {
ExistedFuncs []*Func
ExistedStructs []*Struct
ExistedInterfaces []*Interface
SupportedInterfaces map[*Interface]bool
ValidConstructors map[*Constructor]bool
// contains filtered or unexported fields
}
func NewTypeContext ¶
func NewTypeContext(constructorPattern *regexp.Regexp) *TypeContext
func (*TypeContext) AddFunc ¶
func (tc *TypeContext) AddFunc(f *Func)
func (*TypeContext) AddInterface ¶
func (tc *TypeContext) AddInterface(i *Interface)
func (*TypeContext) AddStruct ¶
func (tc *TypeContext) AddStruct(s *Struct)
func (*TypeContext) AddType ¶
func (tc *TypeContext) AddType(t types.Type)
func (*TypeContext) IsSupported ¶
func (tc *TypeContext) IsSupported( t types.Type, ) bool
type VariablesContext ¶
type VariablesContext struct {
Fabrics map[types.Type]*GeneratedFunc
// contains filtered or unexported fields
}
func NewVariablesContext ¶
func NewVariablesContext(importQualifier *ImportQualifier) *VariablesContext
func (*VariablesContext) CreateUniqueName ¶
func (vc *VariablesContext) CreateUniqueName(wanted string) string
func (*VariablesContext) CreateUniqueNameForVariable ¶
func (vc *VariablesContext) CreateUniqueNameForVariable(v *types.Var) string
Click to show internal directories.
Click to hide internal directories.