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

Function TestAppendStringer

internal/cbor/string_test.go:142–162  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

140}
141
142func TestAppendStringer(t *testing.T) {
143 oldJSONMarshalFunc := JSONMarshalFunc
144 defer func() {
145 JSONMarshalFunc = oldJSONMarshalFunc
146 }()
147
148 JSONMarshalFunc = func(v interface{}) ([]byte, error) {
149 return internal.InterfaceMarshalFunc(v)
150 }
151
152 for _, tt := range internal.EncodeStringerTests {
153 got := enc.AppendStringer([]byte{}, tt.In)
154 want := []byte(tt.Binary)
155 if !bytes.Equal(got, want) {
156 t.Errorf("AppendStrings(%v)\ngot: %s\nwant: %s",
157 tt.In,
158 hex.EncodeToString(got),
159 hex.EncodeToString(want))
160 }
161 }
162}
163
164func TestAppendStringers(t *testing.T) {
165 for _, tt := range internal.EncodeStringersTests {

Callers

nothing calls this directly

Calls 2

InterfaceMarshalFuncFunction · 0.92
AppendStringerMethod · 0.45

Tested by

no test coverage detected