You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea: Adding the functionality to mock function types.
The motivation: Functions are first class objects that are passed into functions/methods and stored in structs. To test that we have the desired behaviour where they are being used it would be useful to be able to mock them in a similar fashion to interfaces.
What I am asking: Would you consider adding support for such functionality? See below for an example setup and expected result. N.B. I thought it useful to ask if you would consider it before I attempt to implement a solution.
The expectation would be that running go generate on
//go:generate moq -out mocks.go . Solver// Solver represent a function that solves a problem that// takes a long time.typeSolverfunc(ctx context.Context, in [][]int) ([]int, error)
yields something (along with suitable documentation) similar to
The idea: Adding the functionality to mock function types.
The motivation: Functions are first class objects that are passed into functions/methods and stored in structs. To test that we have the desired behaviour where they are being used it would be useful to be able to mock them in a similar fashion to interfaces.
What I am asking: Would you consider adding support for such functionality? See below for an example setup and expected result. N.B. I thought it useful to ask if you would consider it before I attempt to implement a solution.
The expectation would be that running
go generate
onyields something (along with suitable documentation) similar to
The text was updated successfully, but these errors were encountered: