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

Function TestLoggerFatalOnNoop

logger_test.go:828–837  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

826}
827
828func TestLoggerFatalOnNoop(t *testing.T) {
829 exitStub := exit.Stub()
830 defer exitStub.Unstub()
831 core, _ := observer.New(InfoLevel)
832
833 // We don't allow a no-op fatal hook.
834 New(core, WithFatalHook(zapcore.WriteThenNoop)).Fatal("great sadness")
835 assert.True(t, exitStub.Exited, "must exit for WriteThenNoop")
836 assert.Equal(t, 1, exitStub.Code, "must exit with status 1 for WriteThenNoop")
837}
838
839func TestLoggerCustomOnPanic(t *testing.T) {
840 tests := []struct {

Callers

nothing calls this directly

Calls 6

StubFunction · 0.92
NewFunction · 0.92
WithFatalHookFunction · 0.85
UnstubMethod · 0.80
NewFunction · 0.70
FatalMethod · 0.45

Tested by

no test coverage detected