Closed mingforpc closed 1 year ago
func TestA(t testing.T) { a := &A{} gomonkey.ApplyMethod(reflect.TypeOf(a), "FuncA", func(_ A) string { return "FuncA1" })
b := A{} // just b
gomonkey.ApplyMethod(reflect.TypeOf(b), "FuncB", func(_ A) string {
return "FuncB1"
})
fmt.Println(a.FuncA())
fmt.Println(a.FuncB())
}
output:
FuncA1 FuncB1
version: v2.0.2+incompatible
work on: mac x86
output:
How can I mock
FuncB
? Thanks you!