(t *testing.T, tt testCase)
| 94 | } |
| 95 | |
| 96 | func testEncode(t *testing.T, tt testCase) { |
| 97 | t.Helper() |
| 98 | |
| 99 | e := json.NewEncoder(func(options *json.EncoderOptions) { |
| 100 | *options = tt.encoderOptions |
| 101 | }) |
| 102 | |
| 103 | encodeBytes, err := e.Encode(tt.actual) |
| 104 | if (err != nil) != tt.wantErr { |
| 105 | t.Errorf("Encode() error = %v, wantErr %v", err, tt.wantErr) |
| 106 | } |
| 107 | |
| 108 | expect := MustJSONUnmarshal(tt.json, !tt.disableJSONNumber) |
| 109 | got := MustJSONUnmarshal(encodeBytes, !tt.disableJSONNumber) |
| 110 | |
| 111 | if !reflect.DeepEqual(expect, got) { |
| 112 | t.Errorf("%v != %v", expect, got) |
| 113 | } |
| 114 | } |
no test coverage detected