exit

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2018 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exit

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.

Types

type StubbedExit

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

A StubbedExit is a testing fake for os.Exit.

func Stub

func Stub() *StubbedExit

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

func WithStub

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

func (se *StubbedExit) Unstub()

Unstub restores the previous exit function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL