Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMockCLI ¶
NewMockCLI return SensuCLI instance w/ mocked values
Types ¶
type FileCapture ¶
type FileCapture struct {
// contains filtered or unexported fields
}
FileCapture helps us write tests where we want to assert that something was written to STDOUT or STDERR.
Usage:
stdout := NewFileCapture(&os.Stdin) stdout.Start() fmt.Println("omgomgomg") stdout.Stop() assert.Equal("omgomgomg", stdout.Output())
func NewFileCapture ¶
func NewFileCapture(f **os.File) FileCapture
NewFileCapture instantiates new FileCapture
func (*FileCapture) Output ¶
func (fc *FileCapture) Output() string
Output exposes the data captured; only available after capture has stopped
func (*FileCapture) Start ¶
func (fc *FileCapture) Start()
Start starts capturing data written to FileCapture#file
func (*FileCapture) Stop ¶
func (fc *FileCapture) Stop()
Stop stops capturing and reads the data to the FileCaputre#output string
Click to show internal directories.
Click to hide internal directories.