Mock.On panics when it expects a func
parameter
#1179
Labels
pkg-mock
Any issues related to Mock
question
Questions related to API usage
rejected/invalid
Not a bug but a misunderstanding by the requester
Hello, I've been having issues mocking an interface that expects a
func
as a parameter. Not sure if this is a bug or maybe an opportunity to improve a little bit the docs (And if this is not the place for this, I'm really really sorry. I hope you can redirect me to the right place to ask these questions)My interface:
My implementation:
My mock:
And inside my test, I have a helper function to create an instance of the mock:
And when I run the test, what I get is:
My guess is there's a problem when I'm using
mock.AnythingOfType("func(row []string) (bool, error)")
inside theMock.On
method. And of course, I can't pass an actualfunc
since by doing this, I'll get an exception:Please let me know if more info is needed. If there's a problem on how I'm using the mock, then I'd like understand and maybe contribute with a tiny PR adding an example to the docs. I think this could help a few folks. I did some research on line and I found people asks these questions but no clear answer is found
The text was updated successfully, but these errors were encountered: