MCPcopy
hub / github.com/uber-go/zap / TestRichErrorSupport

Function TestRichErrorSupport

zapcore/error_test.go:171–180  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func TestRichErrorSupport(t *testing.T) {
172 f := Field{
173 Type: ErrorType,
174 Interface: fmt.Errorf("failed: %w", errors.New("egad")),
175 Key: "k",
176 }
177 enc := NewMapObjectEncoder()
178 f.AddTo(enc)
179 assert.Equal(t, "failed: egad", enc.Fields["k"], "Unexpected basic error message.")
180}
181
182func TestErrArrayBrokenEncoder(t *testing.T) {
183 t.Parallel()

Callers

nothing calls this directly

Calls 3

AddToMethod · 0.95
NewMapObjectEncoderFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected