Documentation ¶
Overview ¶
Package contexttest builds a test context.Context.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Context ¶
Context returns a Context that may be used in tests. Uses ptrace as the platform.Platform.
Note that some filesystems may require a minimal kernel for testing, which this test context does not provide. For such tests, see kernel/contexttest.
func RootContext ¶
RootContext returns a Context that may be used in tests that need root credentials. Uses ptrace as the platform.Platform.
Types ¶
type TestContext ¶
TestContext represents a context with minimal functionality suitable for running tests.
func (*TestContext) RegisterValue ¶
func (t *TestContext) RegisterValue(key, value any)
RegisterValue registers additional values with this test context. Useful for providing values from external packages that contexttest can't depend on.
func (*TestContext) Value ¶
func (t *TestContext) Value(key any) any
Value implements context.Context.