Documentation
¶
Overview ¶
Package cmdtest provides test utilities for testing commands.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeCmdIO ¶
type FakeCmdIO struct {
StdIO *FakeStdioReaderWriter
FileIO *testutil.FakeFileReaderWriter
ExitIO *FakeExiter
}
FakeCmdIO contains fake implementations of the CmdIo dependencies
type FakeExiter ¶
type FakeExiter struct {
// Message is the exit message
Message string
}
FakeExiter doesn't exit, but instead stores the exit message
func (*FakeExiter) Exit ¶
func (e *FakeExiter) Exit(args ...interface{})
Exit stores the exit message
func (*FakeExiter) Exitf ¶
func (e *FakeExiter) Exitf(format string, v ...interface{})
Exitf stores the exit message
type FakeStdioReaderWriter ¶
type FakeStdioReaderWriter struct {
// ReadBytes contains the bytes to be read.
ReadBytes []byte
// ReadErr is an error that occurs during Read. If ReadErr is present, then
// ReadErr will be returned instead of ReadBytes
ReadErr error
// WriteBytes contains a record of the most-recently written bytes.
WriteBytes []byte
// WriteErr is an error that occurs during Write. If WriteErr is present, then
// Write will write not write content and return WriteErr instead.
WriteErr error
}
FakeStdioReaderWriter is a fake implementation of a reader/writer to stdout.
func (*FakeStdioReaderWriter) ReadAll ¶
func (f *FakeStdioReaderWriter) ReadAll() ([]byte, error)
ReadAll returns all the ReadBytes or returns an error.
Click to show internal directories.
Click to hide internal directories.