MCPcopy Create free account
hub / github.com/buger/jsonparser / inputWithSpareCapacity

Function inputWithSpareCapacity

v131_regression_test.go:8–19  ·  view source on GitHub ↗
(data string)

Source from the content-addressed store, hash-verified

6)
7
8func inputWithSpareCapacity(data string) ([]byte, []byte) {
9 input := make([]byte, len(data), len(data)+100)
10 copy(input, data)
11
12 backing := input[:cap(input)]
13 for i := len(input); i < len(backing); i++ {
14 backing[i] = 0xa5
15 }
16
17 snapshot := append([]byte(nil), backing...)
18 return input, snapshot
19}
20
21func assertBackingArrayUnchanged(t *testing.T, input, snapshot []byte) {
22 t.Helper()

Calls

no outgoing calls

Tested by

no test coverage detected