(t *testing.T)
| 374 | } |
| 375 | |
| 376 | func TestContextSetGetValues(t *testing.T) { |
| 377 | c, _ := CreateTestContext(httptest.NewRecorder()) |
| 378 | c.Set("string", "this is a string") |
| 379 | c.Set("int32", int32(-42)) |
| 380 | c.Set("int64", int64(42424242424242)) |
| 381 | c.Set("uint64", uint64(42)) |
| 382 | c.Set("float32", float32(4.2)) |
| 383 | c.Set("float64", 4.2) |
| 384 | var a any = 1 |
| 385 | c.Set("intInterface", a) |
| 386 | |
| 387 | assert.Exactly(t, "this is a string", c.MustGet("string").(string)) |
| 388 | assert.Exactly(t, int32(-42), c.MustGet("int32").(int32)) |
| 389 | assert.Exactly(t, int64(42424242424242), c.MustGet("int64").(int64)) |
| 390 | assert.Exactly(t, uint64(42), c.MustGet("uint64").(uint64)) |
| 391 | assert.InDelta(t, float32(4.2), c.MustGet("float32").(float32), 0.01) |
| 392 | assert.InDelta(t, 4.2, c.MustGet("float64").(float64), 0.01) |
| 393 | assert.Exactly(t, 1, c.MustGet("intInterface").(int)) |
| 394 | } |
| 395 | |
| 396 | func TestContextGetString(t *testing.T) { |
| 397 | c, _ := CreateTestContext(httptest.NewRecorder()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…