oracleRandKey generates a short object key. Includes "" (empty) to exercise the 8th-panic-site hazard. Bracket-style strings like "[0]" are NOT emitted as object keys: they are syntactically ambiguous with array indices in Delete (which uses `keys[last][0] == '['` as the array-mode signal), producin
(r *mathrand.Rand)
| 237 | // signal), producing structural corruption. The dedicated |
| 238 | // TestOracleDeleteBracketKeyAmbiguity test below documents that divergence. |
| 239 | func oracleRandKey(r *mathrand.Rand) string { |
| 240 | switch r.Intn(10) { |
| 241 | case 0: |
| 242 | return "" // empty key — the 8th-panic-site hazard |
| 243 | default: |
| 244 | letters := "abcdefghijklmnopqr" |
| 245 | n := r.Intn(5) + 1 |
| 246 | var b strings.Builder |
| 247 | for i := 0; i < n; i++ { |
| 248 | b.WriteByte(letters[r.Intn(len(letters))]) |
| 249 | } |
| 250 | return b.String() |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | // oracleRandomJSONBytes returns marshaled JSON for a random value, plus the |
| 255 | // Go value itself (so callers can walk the tree to predict sub-values). |
no test coverage detected