MCPcopy
hub / github.com/moonD4rk/HackBrowserData / TestLoggerErrorf

Function TestLoggerErrorf

log/logger_test.go:199–213  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

197}
198
199func TestLoggerErrorf(t *testing.T) {
200 for _, tc := range formatTestCases {
201 tc := tc
202 tc.level = ErrorLevel
203 message := fmt.Sprintf(tc.format, tc.args...)
204 tc.wantedPattern = fmt.Sprintf(`^\[ERR\] %s\n$`, message)
205 t.Run(tc.description, func(t *testing.T) {
206 var buf bytes.Buffer
207 logger := NewLogger(newBase(&buf))
208 logger.Errorf(tc.format, tc.args...)
209 got := buf.String()
210 assert.Regexp(t, tc.wantedPattern, got)
211 })
212 }
213}
214
215func TestLoggerFatalf(t *testing.T) {
216 originalOsExit := osExit

Callers

nothing calls this directly

Calls 4

ErrorfMethod · 0.95
NewLoggerFunction · 0.85
newBaseFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected