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

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

Analyze Your Own Codebase

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

Try Supermodel Free