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

Method TestBuffer_FreeAfterFree

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

Source from the content-addressed store, hash-verified

128}
129
130func (s) TestBuffer_FreeAfterFree(t *testing.T) {
131 buf := newBuffer([]byte("abcd"), mem.NopBufferPool{})
132 if buf.Len() != 4 {
133 t.Fatalf("Buffer length is %d, want 4", buf.Len())
134 }
135
136 // Ensure that a double free does panic.
137 buf.Free()
138 defer checkForPanic(t, "Cannot free freed buffer")
139 buf.Free()
140}
141
142type singleBufferPool struct {
143 t *testing.T

Callers

nothing calls this directly

Calls 5

checkForPanicFunction · 0.85
newBufferFunction · 0.70
LenMethod · 0.65
FatalfMethod · 0.65
FreeMethod · 0.65

Tested by

no test coverage detected