(t *testing.T)
| 81 | } |
| 82 | |
| 83 | func TestEncoderObjectEncodeAPI(t *testing.T) { |
| 84 | t.Run("encode-basic", func(t *testing.T) { |
| 85 | builder := &strings.Builder{} |
| 86 | enc := NewEncoder(builder) |
| 87 | err := enc.EncodeObject(&testObject{ |
| 88 | "漢字", nil, 1, nil, 1, nil, 1, nil, 1, nil, 1, nil, 1, nil, 1, nil, |
| 89 | 1, nil, 1, nil, 1.1, nil, 1.1, nil, true, nil, |
| 90 | &testObject{}, testSliceInts{}, interface{}("test"), |
| 91 | }) |
| 92 | assert.Nil(t, err, "Error should be nil") |
| 93 | assert.Equal( |
| 94 | t, |
| 95 | `{"testStr":"漢字","testInt":1,"testInt64":1,"testInt32":1,"testInt16":1,"testInt8":1,"testUint64":1,"testUint32":1,"testUint16":1,"testUint8":1,"testFloat64":1.1,"testFloat32":1.1,"testBool":true}`, |
| 96 | builder.String(), |
| 97 | "Result of marshalling is different as the one expected", |
| 98 | ) |
| 99 | }) |
| 100 | } |
| 101 | |
| 102 | func TestEncoderObjectMarshalAPI(t *testing.T) { |
| 103 | t.Run("marshal-basic", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…