MCPcopy
hub / github.com/grpc/grpc-go / TestBuffer_SplitAfterFree

Method TestBuffer_SplitAfterFree

mem/buffers_test.go:239–248  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

237}
238
239func (s) TestBuffer_SplitAfterFree(t *testing.T) {
240 // Verify that splitting before freeing does not panic.
241 buf := newBuffer([]byte("abcd"), mem.NopBufferPool{})
242 buf, bufSplit := mem.SplitUnsafe(buf, 2)
243
244 bufSplit.Free()
245 buf.Free()
246 defer checkForPanic(t, "Cannot split freed buffer")
247 mem.SplitUnsafe(buf, 2)
248}
249
250type poolFunc func(*[]byte)
251

Callers

nothing calls this directly

Calls 4

SplitUnsafeFunction · 0.92
checkForPanicFunction · 0.85
newBufferFunction · 0.70
FreeMethod · 0.65

Tested by

no test coverage detected