MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / TFromContext

Function TFromContext

pkg/util/test/context.go:49–55  ·  view source on GitHub ↗

TFromContext returns the *testing.T saved using ContextWithTB from the context.

(ctx context.Context)

Source from the content-addressed store, hash-verified

47
48// TFromContext returns the *testing.T saved using ContextWithTB from the context.
49func TFromContext(ctx context.Context) (*testing.T, bool) {
50 t, ok := ctx.Value(tbKey{}).(*testing.T)
51 if !ok {
52 return nil, false
53 }
54 return t, true
55}
56
57// MustTFromContext returns the *testing.T from the context, and panics if it was not saved in the context.
58func MustTFromContext(ctx context.Context) *testing.T {

Callers 2

NewTFromContextFunction · 0.85
MustTFromContextFunction · 0.85

Calls 1

ValueMethod · 0.45

Tested by

no test coverage detected