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

Function TestRegisterSinkErrors

sink_test.go:86–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestRegisterSinkErrors(t *testing.T) {
87 nopFactory := func(_ *url.URL) (Sink, error) {
88 return nopCloserSink{zapcore.AddSync(io.Discard)}, nil
89 }
90 tests := []struct {
91 scheme string
92 err string
93 }{
94 {"", "empty string"},
95 {"FILE", "already registered"},
96 {"42", "not a valid scheme"},
97 {"http*", "not a valid scheme"},
98 }
99
100 for _, tt := range tests {
101 t.Run("scheme-"+tt.scheme, func(t *testing.T) {
102 r := newSinkRegistry()
103 err := r.RegisterSink(tt.scheme, nopFactory)
104 assert.ErrorContains(t, err, tt.err)
105 })
106 }
107}

Callers

nothing calls this directly

Calls 3

AddSyncFunction · 0.92
newSinkRegistryFunction · 0.85
RegisterSinkMethod · 0.80

Tested by

no test coverage detected