MCPcopy Create free account
hub / github.com/aws/smithy-go / testEncode

Function testEncode

document/json/encoder_test.go:96–114  ·  view source on GitHub ↗
(t *testing.T, tt testCase)

Source from the content-addressed store, hash-verified

94}
95
96func 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}

Callers 1

TestEncoder_EncodeFunction · 0.85

Calls 5

EncodeMethod · 0.95
NewEncoderFunction · 0.92
MustJSONUnmarshalFunction · 0.85
HelperMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected