Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutorMock ¶
type ExecutorMock struct {
// ExecuteFunc mocks the Execute method.
ExecuteFunc func(command string, args ...string) ([]byte, error)
// LookPathFunc mocks the LookPath method.
LookPathFunc func(file string) (string, error)
// contains filtered or unexported fields
}
ExecutorMock is a mock implementation of executor.Executor.
func TestSomethingThatUsesExecutor(t *testing.T) {
// make and configure a mocked executor.Executor
mockedExecutor := &ExecutorMock{
ExecuteFunc: func(command string, args ...string) ([]byte, error) {
panic("mock out the Execute method")
},
LookPathFunc: func(file string) (string, error) {
panic("mock out the LookPath method")
},
}
// use mockedExecutor in code that requires executor.Executor
// and then make assertions.
}
func (*ExecutorMock) Execute ¶
func (mock *ExecutorMock) Execute(command string, args ...string) ([]byte, error)
Execute calls ExecuteFunc.
func (*ExecutorMock) ExecuteCalls ¶
func (mock *ExecutorMock) ExecuteCalls() []struct { Command string Args []string }
ExecuteCalls gets all the calls that were made to Execute. Check the length with:
len(mockedExecutor.ExecuteCalls())
func (*ExecutorMock) LookPath ¶
func (mock *ExecutorMock) LookPath(file string) (string, error)
LookPath calls LookPathFunc.
func (*ExecutorMock) LookPathCalls ¶
func (mock *ExecutorMock) LookPathCalls() []struct { File string }
LookPathCalls gets all the calls that were made to LookPath. Check the length with:
len(mockedExecutor.LookPathCalls())
type WrappedExecuterMock ¶
type WrappedExecuterMock struct {
// ExecuteFunc mocks the Execute method.
ExecuteFunc func(args ...string) ([]byte, error)
// contains filtered or unexported fields
}
WrappedExecuterMock is a mock implementation of executor.WrappedExecuter.
func TestSomethingThatUsesWrappedExecuter(t *testing.T) {
// make and configure a mocked executor.WrappedExecuter
mockedWrappedExecuter := &WrappedExecuterMock{
ExecuteFunc: func(args ...string) ([]byte, error) {
panic("mock out the Execute method")
},
}
// use mockedWrappedExecuter in code that requires executor.WrappedExecuter
// and then make assertions.
}
func (*WrappedExecuterMock) Execute ¶
func (mock *WrappedExecuterMock) Execute(args ...string) ([]byte, error)
Execute calls ExecuteFunc.
func (*WrappedExecuterMock) ExecuteCalls ¶
func (mock *WrappedExecuterMock) ExecuteCalls() []struct { Args []string }
ExecuteCalls gets all the calls that were made to Execute. Check the length with:
len(mockedWrappedExecuter.ExecuteCalls())
Click to show internal directories.
Click to hide internal directories.