MCPcopy
hub / github.com/uber-go/zap / TestLevelEncoders

Function TestLevelEncoders

zapcore/encoder_test.go:564–585  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

562}
563
564func TestLevelEncoders(t *testing.T) {
565 tests := []struct {
566 name string
567 expected interface{} // output of encoding InfoLevel
568 }{
569 {"capital", "INFO"},
570 {"lower", "info"},
571 {"", "info"},
572 {"something-random", "info"},
573 }
574
575 for _, tt := range tests {
576 var le LevelEncoder
577 require.NoError(t, le.UnmarshalText([]byte(tt.name)), "Unexpected error unmarshaling %q.", tt.name)
578 assertAppended(
579 t,
580 tt.expected,
581 func(arr ArrayEncoder) { le(InfoLevel, arr) },
582 "Unexpected output serializing InfoLevel with %q.", tt.name,
583 )
584 }
585}
586
587func TestTimeEncoders(t *testing.T) {
588 moment := time.Unix(100, 50005000).UTC()

Callers

nothing calls this directly

Calls 2

UnmarshalTextMethod · 0.95
assertAppendedFunction · 0.85

Tested by

no test coverage detected