Closed imosquera closed 10 years ago
Not really. The panic is there to make sure that the code compiles. If I remove it then any function literal that is supposed to return a value won't compile.
My thinking behind using panic was that for any public variable you can just set it to something more sensible in your test code, and for private ones it will never get called anyway.
Oh okay, I think that makes sense. The only reason it was failing was because I didn't re-assign that function. I'll give it a go soon.
This is good now. Thanks for the heads up
I've noticed that you throw a Panic for function literals here because you still have work to finish: https://github.com/qur/withmock/blob/master/lib/mock.go#L184
this stops me from stubbing out functions during my tests since it needlessly throws the Panic. Can we remove the panic for now and add in functionality later?