(t *testing.T, command string, fixture json.RawMessage, actual any)
| 620 | } |
| 621 | |
| 622 | func assertGoldenJSONEqual(t *testing.T, command string, fixture json.RawMessage, actual any) { |
| 623 | t.Helper() |
| 624 | |
| 625 | actualJSON, err := json.Marshal(actual) |
| 626 | if err != nil { |
| 627 | t.Fatalf("marshal JSON example for %q: %v", command, err) |
| 628 | } |
| 629 | |
| 630 | var got any |
| 631 | if err := json.Unmarshal(fixture, &got); err != nil { |
| 632 | t.Fatalf("decode golden output for %q: %v", command, err) |
| 633 | } |
| 634 | var want any |
| 635 | if err := json.Unmarshal(actualJSON, &want); err != nil { |
| 636 | t.Fatalf("decode generated output for %q: %v", command, err) |
| 637 | } |
| 638 | if reflect.DeepEqual(got, want) { |
| 639 | return |
| 640 | } |
| 641 | |
| 642 | gotJSON, _ := json.MarshalIndent(got, "", " ") |
| 643 | wantJSON, _ := json.MarshalIndent(want, "", " ") |
| 644 | t.Errorf("golden output for %q = %s, want %s", command, gotJSON, wantJSON) |
| 645 | } |
| 646 | |
| 647 | func assertGoldenSuccessOutputStatuses(t *testing.T, command string, fixture json.RawMessage) { |
| 648 | t.Helper() |
no outgoing calls
no test coverage detected