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

Function TestState_GetBool

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

Source from the content-addressed store, hash-verified

81}
82
83func TestState_GetBool(t *testing.T) {
84 t.Parallel()
85 st := newState()
86
87 st.Set("flag", true)
88 b, ok := st.GetBool("flag")
89 require.True(t, ok)
90 require.True(t, b)
91
92 // wrong type
93 st.Set("num", 1)
94 b, ok = st.GetBool("num")
95 require.False(t, ok)
96 require.False(t, b)
97
98 // missing key should return false
99 b, ok = st.GetBool("missing")
100 require.False(t, ok)
101 require.False(t, b)
102}
103
104func TestState_GetFloat64(t *testing.T) {
105 t.Parallel()

Callers

nothing calls this directly

Calls 3

newStateFunction · 0.85
GetBoolMethod · 0.80
SetMethod · 0.65

Tested by

no test coverage detected