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

Function TestEntryCaller

zapcore/entry_test.go:76–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestEntryCaller(t *testing.T) {
77 tests := []struct {
78 caller EntryCaller
79 full string
80 short string
81 }{
82 {
83 caller: NewEntryCaller(100, "/path/to/foo.go", 42, false),
84 full: "undefined",
85 short: "undefined",
86 },
87 {
88 caller: NewEntryCaller(100, "/path/to/foo.go", 42, true),
89 full: "/path/to/foo.go:42",
90 short: "to/foo.go:42",
91 },
92 {
93 caller: NewEntryCaller(100, "to/foo.go", 42, true),
94 full: "to/foo.go:42",
95 short: "to/foo.go:42",
96 },
97 }
98
99 for _, tt := range tests {
100 assert.Equal(t, tt.full, tt.caller.String(), "Unexpected string from EntryCaller.")
101 assert.Equal(t, tt.full, tt.caller.FullPath(), "Unexpected FullPath from EntryCaller.")
102 assert.Equal(t, tt.short, tt.caller.TrimmedPath(), "Unexpected TrimmedPath from EntryCaller.")
103 }
104}
105
106func TestCheckedEntryWrite(t *testing.T) {
107 t.Run("nil is safe", func(t *testing.T) {

Callers

nothing calls this directly

Calls 4

NewEntryCallerFunction · 0.85
FullPathMethod · 0.80
TrimmedPathMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected