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

Function TestState_GetString

state_test.go:41–60  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestState_GetString(t *testing.T) {
42 t.Parallel()
43 st := newState()
44
45 st.Set("str", "hello")
46 s, ok := st.GetString("str")
47 require.True(t, ok)
48 require.Equal(t, "hello", s)
49
50 // wrong type should return false
51 st.Set("num", 123)
52 s, ok = st.GetString("num")
53 require.False(t, ok)
54 require.Empty(t, s)
55
56 // missing key should return false
57 s, ok = st.GetString("missing")
58 require.False(t, ok)
59 require.Empty(t, s)
60}
61
62func TestState_GetInt(t *testing.T) {
63 t.Parallel()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
SetMethod · 0.65
GetStringMethod · 0.45

Tested by

no test coverage detected