(t *testing.T)
| 397 | } |
| 398 | |
| 399 | func TestEvent_CallerRuntimeFail(t *testing.T) { |
| 400 | var buf bytes.Buffer |
| 401 | e := newEvent(LevelWriterAdapter{&buf}, DebugLevel, false, nil, nil) |
| 402 | |
| 403 | // Set a very large skipFrame to make runtime.Caller fail |
| 404 | e.CallerSkipFrame(1000) |
| 405 | e.Caller() |
| 406 | |
| 407 | e.Msg("test") |
| 408 | |
| 409 | got := strings.TrimSpace(buf.String()) |
| 410 | want := `{"message":"test"}` // No caller field because runtime.Caller failed |
| 411 | if got != want { |
| 412 | t.Errorf("Event.Caller() with failed runtime.Caller = %q, want %q", got, want) |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | func TestEvent_DoneHandler(t *testing.T) { |
| 417 | e := newEvent(nil, InfoLevel, false, nil, nil) |
nothing calls this directly
no test coverage detected