Open jpopadak opened 4 years ago
Please note that the actual Mock object itself is CORRECT. Everything properly compiles and works from that front, it just seems like the generate of the matchers fails.
Hi @jpopadak, thanks for reporting this. Unfortunately, I'm not able to work on this any time soon. If you want to submit a PR, I'm more than happy to merge it.
Description When generating matchers for a given interface method using Pegomock, it fails to create proper matchers for the empty struct type:
struct{}
.As a result, anything that passes around empty struct channels (for event purposes) has incorrect matchers created.
Steps to Reproduce Generate a mock and the matchers associated to this interface:
Note:
recv_chan_of_struct{}.go
{}
of the empty struct in the names of the methods.import ( "reflect" "github.com/petergtz/pegomock"
)
func AnyRecvChanOfStruct{}() <-chan struct{} { pegomock.RegisterMatcher(pegomock.NewAnyMatcher(reflect.TypeOf((*(<-chan struct{}))(nil)).Elem())) var nullValue <-chan struct{} return nullValue }
func EqRecvChanOfStruct{}(value <-chan struct{}) <-chan struct{} { pegomock.RegisterMatcher(&pegomock.EqMatcher{Value: value}) var nullValue <-chan struct{} return nullValue }