zap: go.uber.org/zap/internal/exit Index | Files

package exit

import "go.uber.org/zap/internal/exit"

Package exit provides stubs so that unit tests can exercise code that calls os.Exit(1).

Index

Package Files

exit.go

func Exit Uses

func Exit()

Exit normally terminates the process by calling os.Exit(1). If the package is stubbed, it instead records a call in the testing spy.

type StubbedExit Uses

type StubbedExit struct {
    Exited bool
    // contains filtered or unexported fields
}

A StubbedExit is a testing fake for os.Exit.

func Stub Uses

func Stub() *StubbedExit

Stub substitutes a fake for the call to os.Exit(1).

func WithStub Uses

func WithStub(f func()) *StubbedExit

WithStub runs the supplied function with Exit stubbed. It returns the stub used, so that users can test whether the process would have crashed.

func (*StubbedExit) Unstub Uses

func (se *StubbedExit) Unstub()

Unstub restores the previous exit function.

Package exit imports 1 packages (graph) and is imported by 1 packages. Updated 2017-02-15. Refresh now. Tools for package owners.