Home / File/ state_test.go — fiber Source File

state_test.go — fiber Source File

Architecture documentation for state_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.

File go FiberCore Context 1 imports 64 functions 1 classes

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

Classes

Types

Dependencies

  • strconv

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