MCPcopy
hub / github.com/go-git/go-git / TestGetAndPutByteSlice

Function TestGetAndPutByteSlice

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

Source from the content-addressed store, hash-verified

28}
29
30func TestGetAndPutByteSlice(t *testing.T) {
31 slice := GetByteSlice()
32 if slice == nil {
33 t.Error("nil was not expected")
34 }
35
36 wanted := 16 * 1024
37 got := len(*slice)
38 if wanted != got {
39 t.Errorf("byte slice length: wanted %d got %d", wanted, got)
40 }
41
42 newByteSlice := make([]byte, wanted*2)
43 PutByteSlice(&newByteSlice)
44
45 newSlice := GetByteSlice()
46 if len(*newSlice) != len(newByteSlice) {
47 t.Error("byte slice was not reused")
48 }
49}

Callers

nothing calls this directly

Calls 3

GetByteSliceFunction · 0.85
PutByteSliceFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…