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

Function TestFieldsArrayNil

log_test.go:528–560  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

526}
527
528func TestFieldsArrayNil(t *testing.T) {
529 out := &bytes.Buffer{}
530 log := New(out)
531 log.Log().
532 Objects("objs", nil).
533 ObjectsV("objs_v").
534 Strs("strs", nil).
535 StrsV("strs_v").
536 Stringers("stringers", nil).
537 StringersV("stringers_v").
538 Errs("err", nil).
539 Bools("bool", nil).
540 Ints("int", nil).
541 Ints8("int8", nil).
542 Ints16("int16", nil).
543 Ints32("int32", nil).
544 Ints64("int64", nil).
545 Uints("uint", nil).
546 Uints8("uint8", nil).
547 Uints16("uint16", nil).
548 Uints32("uint32", nil).
549 Uints64("uint64", nil).
550 Floats32("float32", nil).
551 Floats64("float64", nil).
552 Durs("dur", nil).
553 Times("time", nil).
554 IPAddrs("ip", nil).
555 IPPrefixes("pfx", nil).
556 Msg("")
557 if got, want := decodeIfBinaryToString(out.Bytes()), `{"objs":[],"objs_v":[],"strs":[],"strs_v":[],"stringers":[],"stringers_v":[],"err":[],"bool":[],"int":[],"int8":[],"int16":[],"int32":[],"int64":[],"uint":[],"uint8":[],"uint16":[],"uint32":[],"uint64":[],"float32":[],"float64":[],"dur":[],"time":[],"ip":[],"pfx":[]}`+"\n"; got != want {
558 t.Errorf("invalid log output:\ngot: %v\nwant: %v", got, want)
559 }
560}
561
562func TestFieldsArrayEmpty(t *testing.T) {
563 out := &bytes.Buffer{}

Callers

nothing calls this directly

Calls 15

NewFunction · 0.85
MsgMethod · 0.80
decodeIfBinaryToStringFunction · 0.70
LogMethod · 0.65
IPPrefixesMethod · 0.45
IPAddrsMethod · 0.45
TimesMethod · 0.45
DursMethod · 0.45
Floats64Method · 0.45
Floats32Method · 0.45
Uints64Method · 0.45
Uints32Method · 0.45

Tested by

no test coverage detected