(t *testing.T)
| 84 | } |
| 85 | |
| 86 | func 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 | } |
nothing calls this directly
no test coverage detected