Documentation ¶
Overview ¶
Package gomockctx contains gomock helpers for matching context.Context objects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Eq ¶
Eq accepts a context with a gomockctx ID value (as returned from New), and returns a gomock.Matcher which returns true for the given context, and any child contexts of it.
If ctx was not returned from New, the resulting matcher will ALWAYS return false.
func ID ¶
ID returns the gomockctx ID value in the given context, or a empty string if the context does not have a gomockctx ID value.
func New ¶
New returns a context as a child of the given parent, which includes a randomized gomockctx ID value set, which makes it a gomockctx context. This can then be used with Eq to get a gomock Matcher which returns true for the context from New, or any child contexts of it.
If crypto/rand returns an error, this will panic trying to generate the gomockctx ID. In practice though, crypto/rand should never return a error.
Types ¶
This section is empty.