(t *testing.T)
| 28 | } |
| 29 | |
| 30 | func TestGetAndPutByteSlice(t *testing.T) { |
| 31 | slice := GetByteSlice() |
| 32 | if slice == nil { |
| 33 | t.Error("nil was not expected") |
| 34 | } |
| 35 | |
| 36 | wanted := 16 * 1024 |
| 37 | got := len(*slice) |
| 38 | if wanted != got { |
| 39 | t.Errorf("byte slice length: wanted %d got %d", wanted, got) |
| 40 | } |
| 41 | |
| 42 | newByteSlice := make([]byte, wanted*2) |
| 43 | PutByteSlice(&newByteSlice) |
| 44 | |
| 45 | newSlice := GetByteSlice() |
| 46 | if len(*newSlice) != len(newByteSlice) { |
| 47 | t.Error("byte slice was not reused") |
| 48 | } |
| 49 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…