(t *testing.T)
| 119 | } |
| 120 | |
| 121 | func TestEncoderStringEncodeAPIErrors(t *testing.T) { |
| 122 | t.Run("pool-error", func(t *testing.T) { |
| 123 | v := "" |
| 124 | enc := BorrowEncoder(nil) |
| 125 | enc.isPooled = 1 |
| 126 | defer func() { |
| 127 | err := recover() |
| 128 | assert.NotNil(t, err, "err shouldnt be nil") |
| 129 | assert.IsType(t, InvalidUsagePooledEncoderError(""), err, "err should be of type InvalidUsagePooledEncoderError") |
| 130 | assert.Equal(t, "Invalid usage of pooled encoder", err.(InvalidUsagePooledEncoderError).Error(), "err should be of type InvalidUsagePooledDecoderError") |
| 131 | }() |
| 132 | _ = enc.EncodeString(v) |
| 133 | assert.True(t, false, "should not be called as it should have panicked") |
| 134 | }) |
| 135 | t.Run("write-error", func(t *testing.T) { |
| 136 | v := "test" |
| 137 | w := TestWriterError("") |
| 138 | enc := BorrowEncoder(w) |
| 139 | defer enc.Release() |
| 140 | err := enc.EncodeString(v) |
| 141 | assert.NotNil(t, err, "err should not be nil") |
| 142 | }) |
| 143 | } |
| 144 | |
| 145 | func TestEncoderStringMarshalAPI(t *testing.T) { |
| 146 | t.Run("basic", func(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…