(t testing.TB, expected any, actual []byte)
| 14 | ) |
| 15 | |
| 16 | func assertJSON(t testing.TB, expected any, actual []byte) { |
| 17 | t.Helper() |
| 18 | |
| 19 | var e, a any |
| 20 | var err error |
| 21 | |
| 22 | if b, ok := expected.([]byte); ok { |
| 23 | err = json.Unmarshal(b, &e) |
| 24 | } else if s, ok := expected.(string); ok { |
| 25 | err = json.Unmarshal([]byte(s), &e) |
| 26 | } else { |
| 27 | t.Fatalf("bug in test: unexpected type %T", expected) |
| 28 | } |
| 29 | |
| 30 | if err != nil { |
| 31 | t.Fatalf("bug in test: %v", err) |
| 32 | } |
| 33 | |
| 34 | if err = json.Unmarshal(actual, &a); err != nil { |
| 35 | t.Fatal(err) |
| 36 | } |
| 37 | |
| 38 | if !reflect.DeepEqual(e, a) { |
| 39 | t.Errorf("\n--- Expected\n+++ Actual\n- %#v\n+ %#v", e, a) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | func TestEscapeJSONPointer(t *testing.T) { |
| 44 | t.Parallel() |
no test coverage detected