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

Function TestState_GetInt

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

Source from the content-addressed store, hash-verified

60}
61
62func TestState_GetInt(t *testing.T) {
63 t.Parallel()
64 st := newState()
65
66 st.Set("num", 456)
67 i, ok := st.GetInt("num")
68 require.True(t, ok)
69 require.Equal(t, 456, i)
70
71 // wrong type should return zero value
72 st.Set("str", "abc")
73 i, ok = st.GetInt("str")
74 require.False(t, ok)
75 require.Equal(t, 0, i)
76
77 // missing key should return zero value
78 i, ok = st.GetInt("missing")
79 require.False(t, ok)
80 require.Equal(t, 0, i)
81}
82
83func TestState_GetBool(t *testing.T) {
84 t.Parallel()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
GetIntMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected