MCPcopy
hub / github.com/gofiber/fiber / TestState_SetAndGet

Function TestState_SetAndGet

state_test.go:26–39  ·  state_test.go::TestState_SetAndGet
(t *testing.T)

Source from the content-addressed store, hash-verified

24}
25
26func TestState_SetAndGet(t *testing.T) {
27 t.Parallel()
28 st := newState()
29
30 // test setting and getting a value
31 st.Set("foo", "bar")
32 val, ok := st.Get("foo")
33 require.True(t, ok)
34 require.Equal(t, "bar", val)
35
36 // test key not found
37 _, ok = st.Get("unknown")
38 require.False(t, ok)
39}
40
41func TestState_GetString(t *testing.T) {
42 t.Parallel()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
SetMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected