Home / Function/ TestContextSetGetAnyKey() — gin Function Reference

TestContextSetGetAnyKey() — gin Function Reference

Architecture documentation for the TestContextSetGetAnyKey() function in context_test.go from the gin codebase.

Entity Profile

Dependency Diagram

graph TD
  90b08904_0b6c_8d1f_89a0_ecfb6d64feb3["TestContextSetGetAnyKey()"]
  ebe0ae48_a62b_a38f_5bac_5bbbd96fc508["context_test.go"]
  90b08904_0b6c_8d1f_89a0_ecfb6d64feb3 -->|defined in| ebe0ae48_a62b_a38f_5bac_5bbbd96fc508
  style 90b08904_0b6c_8d1f_89a0_ecfb6d64feb3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

context_test.go lines 339–364

func TestContextSetGetAnyKey(t *testing.T) {
	c, _ := CreateTestContext(httptest.NewRecorder())

	type key struct{}

	tests := []struct {
		key any
	}{
		{1},
		{int32(1)},
		{int64(1)},
		{uint(1)},
		{float32(1)},
		{key{}},
		{&key{}},
	}

	for _, tt := range tests {
		t.Run(reflect.TypeOf(tt.key).String(), func(t *testing.T) {
			c.Set(tt.key, 1)
			value, ok := c.Get(tt.key)
			assert.True(t, ok)
			assert.Equal(t, 1, value)
		})
	}
}

Domain

Subdomains

Defined In

Frequently Asked Questions

What does TestContextSetGetAnyKey() do?
TestContextSetGetAnyKey() is a function in the gin codebase, defined in context_test.go.
Where is TestContextSetGetAnyKey() defined?
TestContextSetGetAnyKey() is defined in context_test.go at line 339.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free