(t *testing.T)
| 180 | } |
| 181 | |
| 182 | func TestErrArrayBrokenEncoder(t *testing.T) { |
| 183 | t.Parallel() |
| 184 | |
| 185 | f := Field{ |
| 186 | Key: "foo", |
| 187 | Type: ErrorType, |
| 188 | Interface: multierr.Combine( |
| 189 | errors.New("foo"), |
| 190 | errors.New("bar"), |
| 191 | ), |
| 192 | } |
| 193 | |
| 194 | failWith := errors.New("great sadness") |
| 195 | enc := NewMapObjectEncoder() |
| 196 | f.AddTo(brokenArrayObjectEncoder{ |
| 197 | Err: failWith, |
| 198 | ObjectEncoder: enc, |
| 199 | }) |
| 200 | |
| 201 | // Failure to add the field to the encoder |
| 202 | // causes the error to be added as a string field. |
| 203 | assert.Equal(t, "great sadness", enc.Fields["fooError"], |
| 204 | "Unexpected error message.") |
| 205 | } |
| 206 | |
| 207 | // brokenArrayObjectEncoder is an ObjectEncoder |
| 208 | // that builds a broken ArrayEncoder. |
nothing calls this directly
no test coverage detected