Documentation
¶
Overview ¶
Package iface 生成 interface 的实例对象, 通过 fake iface 结果获得
Index ¶
- func BackUpTo(ctx *IContext, iface unsafe.Pointer)
- func GenCallableMethod(ctx *IContext, apply interface{}, proxy PFunc) uintptr
- func MakeInterface(ctx *IContext, funcTabIndex int, itabFunc uintptr, typ reflect.Type) *hack.Iface
- func MakeMethodCaller(to unsafe.Pointer) (uintptr, error)
- func MakeMethodCallerWithCtx(ctx unsafe.Pointer, to uintptr) (uintptr, error)
- type IContext
- type PContext
- type PFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenCallableMethod ¶
GenCallableMethod 生成可以直接 CALL 的接口方法实现, 带上下文 (rdx)
func MakeInterface ¶
MakeInterface 构造 interface 对象, 包含 receive、funcTab 等数据
func MakeMethodCaller ¶
MakeMethodCaller 构造 interface 的方法调用并放到 stub 区 to 桩函数跳转到的地址
Types ¶
type IContext ¶
type IContext struct { // Data 可以传递任意数据 Data interface{} // contains filtered or unexported fields }
IContext 接口 Mock 代码函数的接收体 避免被 mock 的接口变量为 nil, 无法通过单测逻辑中 mock==nil 的判断
Click to show internal directories.
Click to hide internal directories.