(t *testing.T, tt testCase)
| 132 | } |
| 133 | |
| 134 | func testEncode(t *testing.T, tt testCase) { |
| 135 | t.Helper() |
| 136 | |
| 137 | e := json.NewEncoder(func(options *json.EncoderOptions) { |
| 138 | *options = tt.encoderOptions |
| 139 | }) |
| 140 | |
| 141 | encodeBytes, err := e.Encode(tt.actual) |
| 142 | if (err != nil) != tt.wantErr { |
| 143 | t.Errorf("Encode() error = %v, wantErr %v", err, tt.wantErr) |
| 144 | } |
| 145 | |
| 146 | expect := MustJSONUnmarshal(tt.json, !tt.disableJSONNumber) |
| 147 | got := MustJSONUnmarshal(encodeBytes, !tt.disableJSONNumber) |
| 148 | |
| 149 | if !reflect.DeepEqual(expect, got) { |
| 150 | t.Errorf("%v != %v", expect, got) |
| 151 | } |
| 152 | } |
no test coverage detected