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

Function assertInputUnchanged

property_test.go:151–163  ·  view source on GitHub ↗
(t *testing.T, data []byte, fn func())

Source from the content-addressed store, hash-verified

149}
150
151func assertInputUnchanged(t *testing.T, data []byte, fn func()) {
152 t.Helper()
153
154 snapshot := append([]byte(nil), data...)
155 capSnapshot := append([]byte(nil), data[:cap(data)]...)
156 fn()
157 if !bytes.Equal(data, snapshot) {
158 t.Errorf("input data was mutated by the operation")
159 }
160 if !bytes.Equal(data[:cap(data)], capSnapshot) {
161 t.Errorf("input backing array was mutated by the operation")
162 }
163}
164
165// ---------------------------------------------------------------------------
166// Property: Get round-trips on encoding/json-marshaled scalars

Calls

no outgoing calls

Tested by

no test coverage detected