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

Function TestCallerEncoders

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

Source from the content-addressed store, hash-verified

676}
677
678func TestCallerEncoders(t *testing.T) {
679 caller := EntryCaller{Defined: true, File: "/home/jack/src/github.com/foo/foo.go", Line: 42}
680 tests := []struct {
681 name string
682 expected interface{} // output of serializing caller
683 }{
684 {"", "foo/foo.go:42"},
685 {"something-random", "foo/foo.go:42"},
686 {"short", "foo/foo.go:42"},
687 {"full", "/home/jack/src/github.com/foo/foo.go:42"},
688 }
689
690 for _, tt := range tests {
691 var ce CallerEncoder
692 require.NoError(t, ce.UnmarshalText([]byte(tt.name)), "Unexpected error unmarshaling %q.", tt.name)
693 assertAppended(
694 t,
695 tt.expected,
696 func(arr ArrayEncoder) { ce(caller, arr) },
697 "Unexpected output serializing file name as %v with %q.", tt.expected, tt.name,
698 )
699 }
700}
701
702func TestNameEncoders(t *testing.T) {
703 tests := []struct {

Callers

nothing calls this directly

Calls 2

UnmarshalTextMethod · 0.95
assertAppendedFunction · 0.85

Tested by

no test coverage detected