Documentation ¶
Index ¶
- func GenerateFuncMock(writer io.Writer, mockPkg string, mockClz string, fnName string, ...)
- func LookupInPackageScope(pkg *packages.Package, name string) types.Object
- func MockFunc(writer io.Writer, mockPkg string, mockClz string, fset *token.FileSet, ...)
- func SetImportSpecs(f *ast.File, imports []*ast.ImportSpec)
- func WriteFuncDecls(writer io.Writer, fset *token.FileSet, file *ast.File)
- func WriteFuncWithLocalOverrides(writer io.Writer, fset *token.FileSet, fnSpec *ast.FuncDecl, fnName string, ...)
- func WriteImportDecls(writer io.Writer, imports []ImportSpec)
- type ImportSpec
- type ReturnFieldBinding
- type ReturnFieldBindingSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateFuncMock ¶ added in v0.1.9
func GenerateFuncMock( writer io.Writer, mockPkg string, mockClz string, fnName string, paramInfos []*gosyntax.FieldDeclInfo, returnInfos []*gosyntax.FieldDeclInfo, signature *types.Signature, )
GenerateFuncMock generates function mock implementation based on FieldDeclInfo abstraction
func LookupInPackageScope ¶
func MockFunc ¶ added in v0.1.9
func MockFunc( writer io.Writer, mockPkg string, mockClz string, fset *token.FileSet, fnName string, fnParams *ast.FieldList, fnReturns *ast.FieldList, signature *types.Signature, )
MockFunc generates a mocking method on mockClz class generate mockery (https://github.com/vektra/mockery) compatible mocking implementation from syntax based declarations
func SetImportSpecs ¶
func SetImportSpecs(f *ast.File, imports []*ast.ImportSpec)
SetImportSpecs sets ImportSpecs in f's Decls section using the passed ImportSpecs
func WriteImportDecls ¶
func WriteImportDecls(writer io.Writer, imports []ImportSpec)
Types ¶
type ImportSpec ¶
func AppendImportSpec ¶
func AppendImportSpec(specs []ImportSpec, name, p string) []ImportSpec
func CleanImports ¶
func CleanImports(f *ast.File, cleanedImports []ImportSpec) []ImportSpec
func GetFileImports ¶
func GetFileImports(file *ast.File) []ImportSpec
func GetPackageImports ¶
func GetPackageImports(pkg *packages.Package) []ImportSpec
func (*ImportSpec) IsNameDefault ¶
func (s *ImportSpec) IsNameDefault() bool
type ReturnFieldBinding ¶ added in v0.1.9
type ReturnFieldBinding struct { FuncInvokeParamsExpr string MockCallExpr string Fields []ReturnFieldBindingSpec }
type ReturnFieldBindingSpec ¶ added in v0.1.9
Click to show internal directories.
Click to hide internal directories.