Documentation ¶
Overview ¶
Package test contains utility methods for testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Reporter ¶
Reporter wraps a *testing.T, and provides a more useful failure mode when interacting with gomock.Controller.
For example, consider:
func TestMyThing(t *testing.T) { mockCtrl := gomock.NewController(t) defer mockCtrl.Finish() mockObj := something.NewMockMyInterface(mockCtrl) go func() { mockObj.SomeMethod(4, "blah") } }
It hangs without any indication that it's missing an EXPECT() on `mockObj`. Providing the Reporter to the gomock.Controller ctor avoids this, and terminates with useful feedback. i.e.
func TestMyThing(t *testing.T) { mockCtrl := gomock.NewController(test.Reporter{t}) defer mockCtrl.Finish() mockObj := something.NewMockMyInterface(mockCtrl) go func() { mockObj.SomeMethod(4, "blah") // crashes the test now } }
Click to show internal directories.
Click to hide internal directories.