MCPcopy
hub / github.com/labstack/echo / TestContextGetOrInvalidCast

Function TestContextGetOrInvalidCast

context_generic_test.go:62–70  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestContextGetOrInvalidCast(t *testing.T) {
63 c := NewContext(nil, nil)
64
65 c.Set("key", int64(123))
66
67 v, err := ContextGetOr[float32](c, "key", float32(999))
68 assert.ErrorIs(t, err, ErrInvalidKeyType)
69 assert.Equal(t, float32(0), v)
70}

Callers

nothing calls this directly

Calls 2

SetMethod · 0.95
NewContextFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…