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

Function TestWritestoAllSyncs_EvenIfFirstErrors

zapcore/write_syncer_test.go:104–112  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestWritestoAllSyncs_EvenIfFirstErrors(t *testing.T) {
105 failer := &ztest.FailWriter{}
106 second := &bytes.Buffer{}
107 ws := NewMultiWriteSyncer(AddSync(failer), AddSync(second))
108
109 _, err := ws.Write([]byte("fail"))
110 assert.Error(t, err, "Expected error from call to a writer that failed")
111 assert.Equal(t, []byte("fail"), second.Bytes(), "Expected second sink to be written after first error")
112}
113
114func TestMultiWriteSyncerSync_PropagatesErrors(t *testing.T) {
115 badsink := &ztest.Buffer{}

Callers

nothing calls this directly

Calls 5

BytesMethod · 0.95
NewMultiWriteSyncerFunction · 0.85
AddSyncFunction · 0.85
WriteMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected