Documentation ¶
Overview ¶
Package testctx provides a context containing scoped test helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context interface { // T returns the currently in-scope [T]. T() T // Run wraps the [testing.T] Run method, making it mockable. Run(name string, fn func(Context)) // GoMockController returns the [gomock.Controller] relating to the in-scope [T]. // It memoizes the value for subsequent calls. GoMockController() *gomock.Controller // Ensure returns the [ensuring.E] relating to the in-scope [T]. // It returns an interface instead of the concrete type to avoid an import cycle. // It memoizes the value for subsequent calls. Ensure() interface{} }
Context contains scoped test helpers.
type T ¶
type T interface { Logf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Run(name string, f func(t *testing.T)) bool Helper() Cleanup(func()) Parallel() }
T is a minimal implementation of testing.T that may expand whenever a new method is needed.
type WrapEnsure ¶ added in v0.4.1
type WrapEnsure func(T) interface{}
WrapEnsure is a function that returns the [ensuring.E] for the provided T. It returns an interface instead of the concrete type to avoid an import cycle.
Click to show internal directories.
Click to hide internal directories.