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

Function TestAppendStringer

internal/json/string_test.go:27–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestAppendStringer(t *testing.T) {
28 oldJSONMarshalFunc := JSONMarshalFunc
29 defer func() {
30 JSONMarshalFunc = oldJSONMarshalFunc
31 }()
32
33 JSONMarshalFunc = func(v interface{}) ([]byte, error) {
34 return internal.InterfaceMarshalFunc(v)
35 }
36
37 for _, tt := range internal.EncodeStringerTests {
38 b := enc.AppendStringer([]byte{}, tt.In)
39 if got, want := string(b), tt.Out; got != want {
40 t.Errorf("AppendStringer(%q)\ngot: %#q, want: %#q", tt.In, got, want)
41 }
42 }
43}
44
45func TestAppendStringers(t *testing.T) {
46 for _, tt := range internal.EncodeStringersTests {

Callers

nothing calls this directly

Calls 2

InterfaceMarshalFuncFunction · 0.92
AppendStringerMethod · 0.45

Tested by

no test coverage detected