mock

package
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCallOld = errors.New("mock: call old")

Functions

func AddFuncInterceptor deprecated

func AddFuncInterceptor(fn interface{}, interceptor Interceptor) func()

Deprecated: use Mock instead

func CallOld

func CallOld()

func Mock added in v1.0.6

func Mock(fn interface{}, interceptor Interceptor) func()

Mock setup mock on given function `fn`. `fn` can be a function or a method, when `fn` is a method, only the bound instance will be mocked, other instances are not affected. The returned function can be used to cancel the passed interceptor.

Types

type Interceptor

type Interceptor func(ctx context.Context, fn *core.FuncInfo, args core.Object, results core.Object) error

func GetInterceptors

func GetInterceptors() []Interceptor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL