golang / mock

GoMock is a mocking framework for the Go programming language.
Apache License 2.0
9.26k stars 608 forks source link

How to mock receiver in method #706

Open forjoin92 opened 1 year ago

forjoin92 commented 1 year ago

Here is my codes: type A interface { aaa() string cstring() string }

type B struct { c string }

func (b *B) aaa() string { ... s := b.cstring() ... }

func (b *B) cstring() string { return b.c }

How can I mock b.cstring() in B.aaa()?