(t *testing.T, data []byte, fn func())
| 149 | } |
| 150 | |
| 151 | func 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 |
no outgoing calls
no test coverage detected