state_test.go — fiber Source File
Architecture documentation for state_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 040d1690_51eb_9416_23b2_7b1543e92d65["state_test.go"] 51db452a_438a_4ccc_a0d4_94c26533ea58["strconv"] 040d1690_51eb_9416_23b2_7b1543e92d65 --> 51db452a_438a_4ccc_a0d4_94c26533ea58 style 040d1690_51eb_9416_23b2_7b1543e92d65 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package fiber
import (
"strconv"
"testing"
"github.com/stretchr/testify/require"
)
func TestState_SetAndGet_WithApp(t *testing.T) {
t.Parallel()
// Create app
app := New()
// test setting and getting a value
app.State().Set("foo", "bar")
val, ok := app.State().Get("foo")
require.True(t, ok)
require.Equal(t, "bar", val)
// test key not found
_, ok = app.State().Get("unknown")
require.False(t, ok)
}
func TestState_SetAndGet(t *testing.T) {
t.Parallel()
st := newState()
// test setting and getting a value
st.Set("foo", "bar")
val, ok := st.Get("foo")
require.True(t, ok)
require.Equal(t, "bar", val)
// test key not found
_, ok = st.Get("unknown")
require.False(t, ok)
}
func TestState_GetString(t *testing.T) {
t.Parallel()
st := newState()
st.Set("str", "hello")
s, ok := st.GetString("str")
require.True(t, ok)
require.Equal(t, "hello", s)
// wrong type should return false
st.Set("num", 123)
s, ok = st.GetString("num")
require.False(t, ok)
require.Empty(t, s)
// missing key should return false
s, ok = st.GetString("missing")
require.False(t, ok)
require.Empty(t, s)
}
// ... (1221 more lines)
Domain
Subdomains
Functions
- BenchmarkState_Delete()
- BenchmarkState_Get()
- BenchmarkState_GetBool()
- BenchmarkState_GetComplex128()
- BenchmarkState_GetComplex64()
- BenchmarkState_GetFloat32()
- BenchmarkState_GetFloat64()
- BenchmarkState_GetInt()
- BenchmarkState_GetInt16()
- BenchmarkState_GetInt32()
- BenchmarkState_GetInt64()
- BenchmarkState_GetInt8()
- BenchmarkState_GetService()
- BenchmarkState_GetStateGeneric()
- BenchmarkState_GetStateWithDefault()
- BenchmarkState_GetString()
- BenchmarkState_GetUint()
- BenchmarkState_GetUint16()
- BenchmarkState_GetUint32()
- BenchmarkState_GetUint64()
- BenchmarkState_GetUint8()
- BenchmarkState_GetUintptr()
- BenchmarkState_Has()
- BenchmarkState_Keys()
- BenchmarkState_Len()
- BenchmarkState_MustGet()
- BenchmarkState_MustGetService()
- BenchmarkState_MustGetStateGeneric()
- BenchmarkState_Reset()
- BenchmarkState_Set()
- TestState_Delete()
- TestState_GetBool()
- TestState_GetComplex128()
- TestState_GetComplex64()
- TestState_GetFloat32()
- TestState_GetFloat64()
- TestState_GetGeneric()
- TestState_GetInt()
- TestState_GetInt16()
- TestState_GetInt32()
- TestState_GetInt64()
- TestState_GetInt8()
- TestState_GetService()
- TestState_GetString()
- TestState_GetUint()
- TestState_GetUint16()
- TestState_GetUint32()
- TestState_GetUint64()
- TestState_GetUint8()
- TestState_GetUintptr()
- TestState_Has()
- TestState_Keys()
- TestState_Keys_SkipsNonStringKeys()
- TestState_Keys_SkipsNonStringKeys_WithMixedOrder()
- TestState_Len()
- TestState_MustGet()
- TestState_MustGetService()
- TestState_Reset()
- TestState_Service()
- TestState_SetAndGet()
- TestState_SetAndGet_WithApp()
- Test_GetStateWithDefault()
- Test_MustGetStateGeneric()
- runGenericTest()
Classes
Dependencies
- strconv
Source
Frequently Asked Questions
What does state_test.go do?
state_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberCore domain, Context subdomain.
What functions are defined in state_test.go?
state_test.go defines 64 function(s): BenchmarkState_Delete, BenchmarkState_Get, BenchmarkState_GetBool, BenchmarkState_GetComplex128, BenchmarkState_GetComplex64, BenchmarkState_GetFloat32, BenchmarkState_GetFloat64, BenchmarkState_GetInt, BenchmarkState_GetInt16, BenchmarkState_GetInt32, and 54 more.
What does state_test.go depend on?
state_test.go imports 1 module(s): strconv.
Where is state_test.go in the architecture?
state_test.go is located at state_test.go (domain: FiberCore, subdomain: Context).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free