--------------------------------------------------------------------------- Comparison helpers — canonicalize both sides and compare bytes / values. --------------------------------------------------------------------------- canonicalizeJSON unmarshals and re-marshals bytes through encoding/json so
(b []byte)
| 334 | // objects) compares equal. Returns the input unchanged on parse error so the |
| 335 | // caller can decide how to react. |
| 336 | func canonicalizeJSON(b []byte) ([]byte, error) { |
| 337 | var v interface{} |
| 338 | if err := json.Unmarshal(b, &v); err != nil { |
| 339 | return nil, err |
| 340 | } |
| 341 | return json.Marshal(v) |
| 342 | } |
| 343 | |
| 344 | // compareGetToOracle compares jsonparser.Get's output to the expected Go |
| 345 | // value (the reference oracle's prediction). Returns true iff they agree. |
no outgoing calls
no test coverage detected