Open flyinprogrammer opened 3 years ago
Hello again @flyinprogrammer,
So just started looking into this and it is weird, because there's an actual unit test for this: https://github.com/petergtz/pegomock/blob/e07328acdcbfed1c0b19c392a91f30438e093d77/dsl_test.go#L730-L780
So taking a deeper look at it right now.
Actually, now that I look at it, these tests only use the argument capture mechanism. Need to check why this is the case (sorry, written this 4 years ago 😬 )
Ah. The crux is here: https://github.com/petergtz/pegomock/blob/6d417a09fb4ca6f21a532c740917bba9fb807972/dsl.go#L371-L374
This logic is wrong and must be fixed. It might not be as simple as removing this check.
Context: See the context here: https://github.com/petergtz/pegomock/issues/111
Oh hello again!!
So now I've made a new discovery! I've tried mocking out this fancy
PostMessage
method in the slack client:https://github.com/slack-go/slack/blob/master/chat.go#L123
So I wrote an interface and simple wrapper method to mock out something we sort of do in the Atlantis app:
And then a simple test to ensure that our slack client receives something we expect:
And it goes 💥 with:
Which is quite odd because it was invoked with the signature, but somehow it wasn't?
Here's the example project: https://github.com/flyinprogrammer/pegomock_examples/tree/issue/variadic
I've tried debugging this in GoLand, but unfortunately I am 🥔. I'll keep poking this to learn how this project works, but if someone happens to know a workaround, or is up for teaching me how or what went wrong I'd love to learn.