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

Method TestBuffer_ReadOnlyDataAfterFree

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

Source from the content-addressed store, hash-verified

214}
215
216func (s) TestBuffer_ReadOnlyDataAfterFree(t *testing.T) {
217 // Verify that reading before freeing does not panic.
218 buf := newBuffer([]byte("abcd"), mem.NopBufferPool{})
219 buf.ReadOnlyData()
220
221 buf.Free()
222 defer checkForPanic(t, "Cannot read freed buffer")
223 buf.ReadOnlyData()
224}
225
226func (s) TestBuffer_RefAfterFree(t *testing.T) {
227 // Verify that acquiring a ref before freeing does not panic.

Callers

nothing calls this directly

Calls 4

checkForPanicFunction · 0.85
newBufferFunction · 0.70
ReadOnlyDataMethod · 0.65
FreeMethod · 0.65

Tested by

no test coverage detected