(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestStats_Copy(t *testing.T) { |
| 12 | t.Run("stats is nil", func(t *testing.T) { |
| 13 | var stats *QueryStats |
| 14 | copied := stats.Copy() |
| 15 | assert.Nil(t, copied) |
| 16 | }) |
| 17 | t.Run("stats is not nil", func(t *testing.T) { |
| 18 | stats, _ := ContextWithEmptyStats(context.Background()) |
| 19 | stats.AddWallTime(time.Second) |
| 20 | copied := stats.Copy() |
| 21 | |
| 22 | // value should be the same |
| 23 | assert.Equal(t, time.Second, copied.LoadWallTime()) |
| 24 | p1, p2 := &copied, &stats |
| 25 | |
| 26 | // address should be different |
| 27 | assert.False(t, p1 == p2) |
| 28 | }) |
| 29 | } |
| 30 | |
| 31 | func TestStats_WallTime(t *testing.T) { |
| 32 | t.Run("add and load wall time", func(t *testing.T) { |
nothing calls this directly
no test coverage detected