(t *testing.T)
| 337 | } |
| 338 | |
| 339 | func TestContextSetGetAnyKey(t *testing.T) { |
| 340 | c, _ := CreateTestContext(httptest.NewRecorder()) |
| 341 | |
| 342 | type key struct{} |
| 343 | |
| 344 | tests := []struct { |
| 345 | key any |
| 346 | }{ |
| 347 | {1}, |
| 348 | {int32(1)}, |
| 349 | {int64(1)}, |
| 350 | {uint(1)}, |
| 351 | {float32(1)}, |
| 352 | {key{}}, |
| 353 | {&key{}}, |
| 354 | } |
| 355 | |
| 356 | for _, tt := range tests { |
| 357 | t.Run(reflect.TypeOf(tt.key).String(), func(t *testing.T) { |
| 358 | c.Set(tt.key, 1) |
| 359 | value, ok := c.Get(tt.key) |
| 360 | assert.True(t, ok) |
| 361 | assert.Equal(t, 1, value) |
| 362 | }) |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | func TestContextSetGetPanicsWhenKeyNotComparable(t *testing.T) { |
| 367 | c, _ := CreateTestContext(httptest.NewRecorder()) |
nothing calls this directly
no test coverage detected