-
Notifications
You must be signed in to change notification settings - Fork 31
Pegomock unable to generate proper matchers for empty struct channels #101
Copy link
Copy link
Open
Description
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:
type MyInterf interface {
MyFunc(stopChan <-chan struct{}) error
}Note:
- The filename of the matcher:
recv_chan_of_struct{}.go - The output of the matchers which includes the
{}of the empty struct in the names of the methods.
// Code generated by pegomock. DO NOT EDIT.
package matchers
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
}Thoughts
This might be just due to how we are naming things based on the type name. If so, this could theoretically be a spot fix based on any type of struct{}.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels