-
Notifications
You must be signed in to change notification settings - Fork 157
Description
Actual behavior: If controller.Finish() is called and then also deferred, any following panic is recovered and silently discarded by the controller. Also, no error message is printed regarding several calls to controller.Finish(), which should be called only once.
Expected behavior: I expected the panic to happen and the test to fail, or at least an error message to be printed about multiple calls to controller.Finish().
To Reproduce: Here is a minimal Go Playground example.
Additional Information
The exact return causing the behavior is this one.
I know this is not a completely conventional usage of the library. However, I think it's not nice that the library can silently ignore a panic under certain conditions. Docs also state nothing about the exact side-effects of executing controller.Finish() several times, they just say that it is not idempotent and therefore can only be invoked once. and if you pass a *testing.T into NewController, you no longer need to call ctrl.Finish() in your test methods.
- gomock mode (reflect or source): source
- gomock version or git ref: v0.5.0
- golang version: 1.24