MCPcopy
hub / github.com/rs/zerolog / TestNewHandler

Function TestNewHandler

hlog/hlog_test.go:30–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestNewHandler(t *testing.T) {
31 log := zerolog.New(nil).With().
32 Str("foo", "bar").
33 Logger()
34 lh := NewHandler(log)
35 h := lh(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
36 l := FromRequest(r)
37 if !reflect.DeepEqual(*l, log) {
38 t.Fail()
39 }
40 }))
41 h.ServeHTTP(nil, &http.Request{})
42}
43
44func TestURLHandler(t *testing.T) {
45 out := &bytes.Buffer{}

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
NewHandlerFunction · 0.85
FromRequestFunction · 0.85
LoggerMethod · 0.80
WithMethod · 0.80
StrMethod · 0.45

Tested by

no test coverage detected