MCPcopy Index your code
hub / github.com/go-git/go-git / TestGetAndPutBytesBuffer

Function TestGetAndPutBytesBuffer

utils/sync/bytes_test.go:7–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

5)
6
7func 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
30func TestGetAndPutByteSlice(t *testing.T) {
31 slice := GetByteSlice()

Callers

nothing calls this directly

Calls 4

GetBytesBufferFunction · 0.85
PutBytesBufferFunction · 0.85
ErrorMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…