ErrNotFound occurs when the expected value does not exist in the context.
var ErrNotFound = errors.New("not found in context")
func ValueFrom[V any](ctx context.Context) *V
ValueFrom allows retrieving a type-safe value that was stored using ValueInto[T] Only one instance of each type can be stored. Typically used for storing framework extensions in context, since there should only be one of those per instance of the framework.
func ValueFromT[V any](ctx context.Context, t *testing.T) *V
ValueFromT is a testing variant of ValueFrom that will automatically fail the test if the value being retrieved doesn't exist in ctx.
Context is the f2.Framework test context. It carries test configuration and state throughout the various stages of test execution. Individual tests and framework functions can pass state in a loosely coupled way by using WithValue, like a standard context.Context.
type Context struct { RunID string context.Context }
func ValueInto[V any](parent Context, v *V) Context
ValueInto is a type-safe helper for storing a value in a context by its type. Only one instance of each type can be stored. Typically used for storing framework extensions in context, since there should only be one of those per instance of the framework.
func WithCancel(c Context) (Context, context.CancelFunc)
WithCancel is equivalent to context.WithCancel while preserving the generic Context implementation. It should be used when mutating f2.Context.
func WithDeadline(parent Context, d time.Time) (Context, context.CancelFunc)
WithDeadline is equivalent to context.WithDeadline while preserving the generic Context implementation. It should be used when mutating f2.Context.
func WithTimeout(parent Context, timeout time.Duration) (Context, context.CancelFunc)
WithTimeout is equivalent to context.WithTimeout while preserving the generic Context implementation. It should be used when mutating f2.Context.
func WithValue(parent Context, k, v any) Context
WithValue is equivalent to context.WithValue while preserving the generic Context implementation. It should be used when mutating f2.Context.
func (c Context) InnerContext() context.Context
InnerContext returns the wrapped context.Context
func (c Context) WithInnerContext(ctx context.Context) Context
WithInnerContext updates the wrapped context.Context