(t *testing.T)
| 5 | ) |
| 6 | |
| 7 | func TestGetAndPutBytesBuffer(t *testing.T) { |
| 8 | buf := GetBytesBuffer() |
| 9 | if buf == nil { |
| 10 | t.Error("nil was not expected") |
| 11 | } |
| 12 | |
| 13 | initialLen := buf.Len() |
| 14 | buf.Grow(initialLen * 2) |
| 15 | grownLen := buf.Len() |
| 16 | |
| 17 | PutBytesBuffer(buf) |
| 18 | |
| 19 | buf = GetBytesBuffer() |
| 20 | if buf.Len() != grownLen { |
| 21 | t.Error("bytes buffer was not reused") |
| 22 | } |
| 23 | |
| 24 | buf2 := GetBytesBuffer() |
| 25 | if buf2.Len() != initialLen { |
| 26 | t.Errorf("new bytes buffer length: wanted %d got %d", initialLen, buf2.Len()) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func TestGetAndPutByteSlice(t *testing.T) { |
| 31 | slice := GetByteSlice() |
nothing calls this directly
no test coverage detected
searching dependent graphs…