petergtz / pegomock

Pegomock is a powerful, yet simple mocking framework for the Go programming language
Apache License 2.0
252 stars 28 forks source link

Matchers are not generated for Variadic Arguments #90

Closed jpopadak closed 4 years ago

jpopadak commented 5 years ago

Generating mocks for an Interface which has Variadic functions does not create matchers for the variadic arguments.

Test File

//go:generate -m github.com/org/project/package/name Asdf

Source File

package name

type Structure struct{}
type Asdf interface {
    Function(values ...Structure)
}
petergtz commented 5 years ago

@jpopadak True. The variadic args do give you a hard time these days :-/. Thanks for reporting it. It's a bug. It looks pretty straight forward, so I'll see if I can fix it soon.

petergtz commented 5 years ago

@jpopadak Can you please try with the latest on develop? If that solves your issue, I will merge it to master and make a new release.

petergtz commented 5 years ago

@jpopadak Did you get a chance to check this?

jpopadak commented 4 years ago

I will try it out again sometime this week. Sorry about that.

jpopadak commented 4 years ago

So matchers are being generated for it now 🎉

However, they are not being used to match calls for variadic arguments. I would consider that another / different bug though.

petergtz commented 4 years ago

@jpopadak could you be more specific? Basically provide a use case where is doesn't work for you?

The current expected behavior is that you need to provide as many matchers as you expect parameters to be passed to your mock. Only then will it match that call.

petergtz commented 4 years ago

@jpopadak I'm going to close this issue as per your comment above. However, could open a new issue for what you called a "different bug" above. Thank you.