Closed Sychorius closed 1 year ago
support mocking struct functional filed
feat: support mocking struct functional filed
en: support mocking struct functional field zh: 支持mock结构体内函数类的成员变量指向的函数
eg:
type Fn func() type Foo struct { privateField Fn } func NewFoo() *Foo { return &Foo{privateField: func() { /*anonymous function, do nothing*/ }} } var foo interface{} = NewFoo()
we can mock Foo.privateField as below:
Foo.privateField
Mock(GetMethod(foo,"privateField"))
support mocking struct functional filed
What type of PR is this?
feat: support mocking struct functional filed
What this PR does / why we need it (en: English/zh: Chinese):
en: support mocking struct functional field zh: 支持mock结构体内函数类的成员变量指向的函数
eg:
we can mock
Foo.privateField
as below: