Documentation
¶
Index ¶
- type CommandMock
- func (mock *CommandMock) CombinedOutput() ([]byte, error)
- func (mock *CommandMock) CombinedOutputCalls() []struct{}
- func (mock *CommandMock) Err() error
- func (mock *CommandMock) ErrCalls() []struct{}
- func (mock *CommandMock) PID() int
- func (mock *CommandMock) PIDCalls() []struct{}
- func (mock *CommandMock) SetStderr(file *os.File)
- func (mock *CommandMock) SetStderrCalls() []struct{ ... }
- func (mock *CommandMock) SetStdin(file *os.File)
- func (mock *CommandMock) SetStdinCalls() []struct{ ... }
- func (mock *CommandMock) SetStdout(file *os.File)
- func (mock *CommandMock) SetStdoutCalls() []struct{ ... }
- func (mock *CommandMock) SetSysProcAttr(sysProcAttr *syscall.SysProcAttr)
- func (mock *CommandMock) SetSysProcAttrCalls() []struct{ ... }
- func (mock *CommandMock) Start() error
- func (mock *CommandMock) StartCalls() []struct{}
- func (mock *CommandMock) Wait() error
- func (mock *CommandMock) WaitCalls() []struct{}
- type DecoderFactoryMock
- type DecoderMock
- type EncoderFactoryMock
- type EncoderMock
- func (mock *EncoderMock) Encode(data any) error
- func (mock *EncoderMock) EncodeCalls() []struct{ ... }
- func (mock *EncoderMock) SetEscapeHTML(escape bool)
- func (mock *EncoderMock) SetEscapeHTMLCalls() []struct{ ... }
- func (mock *EncoderMock) SetIndent(prefix string, indent string)
- func (mock *EncoderMock) SetIndentCalls() []struct{ ... }
- type OsProxyMock
- func (mock *OsProxyMock) Create(name string) (*os.File, error)
- func (mock *OsProxyMock) CreateCalls() []struct{ ... }
- func (mock *OsProxyMock) Executable() (string, error)
- func (mock *OsProxyMock) ExecutableCalls() []struct{}
- func (mock *OsProxyMock) FindProcess(pid int) (*os.Process, error)
- func (mock *OsProxyMock) FindProcessCalls() []struct{ ... }
- func (mock *OsProxyMock) Getwd() (string, error)
- func (mock *OsProxyMock) GetwdCalls() []struct{}
- func (mock *OsProxyMock) Hostname() (string, error)
- func (mock *OsProxyMock) HostnameCalls() []struct{}
- func (mock *OsProxyMock) MkdirAll(name string, mode os.FileMode) error
- func (mock *OsProxyMock) MkdirAllCalls() []struct{ ... }
- func (mock *OsProxyMock) OpenFile(name string, flag int, perm os.FileMode) (*os.File, error)
- func (mock *OsProxyMock) OpenFileCalls() []struct{ ... }
- func (mock *OsProxyMock) ReadFileIfExists(name string) (string, bool, error)
- func (mock *OsProxyMock) ReadFileIfExistsCalls() []struct{ ... }
- func (mock *OsProxyMock) Remove(name string) error
- func (mock *OsProxyMock) RemoveCalls() []struct{ ... }
- func (mock *OsProxyMock) Stat(pth string) (os.FileInfo, error)
- func (mock *OsProxyMock) StatCalls() []struct{ ... }
- func (mock *OsProxyMock) TempDir() string
- func (mock *OsProxyMock) TempDirCalls() []struct{}
- func (mock *OsProxyMock) UserHomeDir() (string, error)
- func (mock *OsProxyMock) UserHomeDirCalls() []struct{}
- func (mock *OsProxyMock) WriteFile(name string, data []byte, mode os.FileMode) error
- func (mock *OsProxyMock) WriteFileCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommandMock ¶
type CommandMock struct {
// CombinedOutputFunc mocks the CombinedOutput method.
CombinedOutputFunc func() ([]byte, error)
// ErrFunc mocks the Err method.
ErrFunc func() error
// PIDFunc mocks the PID method.
PIDFunc func() int
// SetStderrFunc mocks the SetStderr method.
SetStderrFunc func(file *os.File)
// SetStdinFunc mocks the SetStdin method.
SetStdinFunc func(file *os.File)
// SetStdoutFunc mocks the SetStdout method.
SetStdoutFunc func(file *os.File)
// SetSysProcAttrFunc mocks the SetSysProcAttr method.
SetSysProcAttrFunc func(sysProcAttr *syscall.SysProcAttr)
// StartFunc mocks the Start method.
StartFunc func() error
// WaitFunc mocks the Wait method.
WaitFunc func() error
// contains filtered or unexported fields
}
CommandMock is a mock implementation of utils.Command.
func TestSomethingThatUsesCommand(t *testing.T) {
// make and configure a mocked utils.Command
mockedCommand := &CommandMock{
CombinedOutputFunc: func() ([]byte, error) {
panic("mock out the CombinedOutput method")
},
ErrFunc: func() error {
panic("mock out the Err method")
},
PIDFunc: func() int {
panic("mock out the PID method")
},
SetStderrFunc: func(file *os.File) {
panic("mock out the SetStderr method")
},
SetStdinFunc: func(file *os.File) {
panic("mock out the SetStdin method")
},
SetStdoutFunc: func(file *os.File) {
panic("mock out the SetStdout method")
},
SetSysProcAttrFunc: func(sysProcAttr *syscall.SysProcAttr) {
panic("mock out the SetSysProcAttr method")
},
StartFunc: func() error {
panic("mock out the Start method")
},
WaitFunc: func() error {
panic("mock out the Wait method")
},
}
// use mockedCommand in code that requires utils.Command
// and then make assertions.
}
func (*CommandMock) CombinedOutput ¶
func (mock *CommandMock) CombinedOutput() ([]byte, error)
CombinedOutput calls CombinedOutputFunc.
func (*CommandMock) CombinedOutputCalls ¶
func (mock *CommandMock) CombinedOutputCalls() []struct { }
CombinedOutputCalls gets all the calls that were made to CombinedOutput. Check the length with:
len(mockedCommand.CombinedOutputCalls())
func (*CommandMock) ErrCalls ¶
func (mock *CommandMock) ErrCalls() []struct { }
ErrCalls gets all the calls that were made to Err. Check the length with:
len(mockedCommand.ErrCalls())
func (*CommandMock) PIDCalls ¶
func (mock *CommandMock) PIDCalls() []struct { }
PIDCalls gets all the calls that were made to PID. Check the length with:
len(mockedCommand.PIDCalls())
func (*CommandMock) SetStderr ¶
func (mock *CommandMock) SetStderr(file *os.File)
SetStderr calls SetStderrFunc.
func (*CommandMock) SetStderrCalls ¶
func (mock *CommandMock) SetStderrCalls() []struct { File *os.File }
SetStderrCalls gets all the calls that were made to SetStderr. Check the length with:
len(mockedCommand.SetStderrCalls())
func (*CommandMock) SetStdin ¶
func (mock *CommandMock) SetStdin(file *os.File)
SetStdin calls SetStdinFunc.
func (*CommandMock) SetStdinCalls ¶
func (mock *CommandMock) SetStdinCalls() []struct { File *os.File }
SetStdinCalls gets all the calls that were made to SetStdin. Check the length with:
len(mockedCommand.SetStdinCalls())
func (*CommandMock) SetStdout ¶
func (mock *CommandMock) SetStdout(file *os.File)
SetStdout calls SetStdoutFunc.
func (*CommandMock) SetStdoutCalls ¶
func (mock *CommandMock) SetStdoutCalls() []struct { File *os.File }
SetStdoutCalls gets all the calls that were made to SetStdout. Check the length with:
len(mockedCommand.SetStdoutCalls())
func (*CommandMock) SetSysProcAttr ¶
func (mock *CommandMock) SetSysProcAttr(sysProcAttr *syscall.SysProcAttr)
SetSysProcAttr calls SetSysProcAttrFunc.
func (*CommandMock) SetSysProcAttrCalls ¶
func (mock *CommandMock) SetSysProcAttrCalls() []struct { SysProcAttr *syscall.SysProcAttr }
SetSysProcAttrCalls gets all the calls that were made to SetSysProcAttr. Check the length with:
len(mockedCommand.SetSysProcAttrCalls())
func (*CommandMock) StartCalls ¶
func (mock *CommandMock) StartCalls() []struct { }
StartCalls gets all the calls that were made to Start. Check the length with:
len(mockedCommand.StartCalls())
func (*CommandMock) WaitCalls ¶
func (mock *CommandMock) WaitCalls() []struct { }
WaitCalls gets all the calls that were made to Wait. Check the length with:
len(mockedCommand.WaitCalls())
type DecoderFactoryMock ¶
type DecoderFactoryMock struct {
// DecoderFunc mocks the Decoder method.
DecoderFunc func(r io.Reader) utils.Decoder
// contains filtered or unexported fields
}
DecoderFactoryMock is a mock implementation of utils.DecoderFactory.
func TestSomethingThatUsesDecoderFactory(t *testing.T) {
// make and configure a mocked utils.DecoderFactory
mockedDecoderFactory := &DecoderFactoryMock{
DecoderFunc: func(r io.Reader) utils.Decoder {
panic("mock out the Decoder method")
},
}
// use mockedDecoderFactory in code that requires utils.DecoderFactory
// and then make assertions.
}
func (*DecoderFactoryMock) Decoder ¶
func (mock *DecoderFactoryMock) Decoder(r io.Reader) utils.Decoder
Decoder calls DecoderFunc.
func (*DecoderFactoryMock) DecoderCalls ¶
func (mock *DecoderFactoryMock) DecoderCalls() []struct { R io.Reader }
DecoderCalls gets all the calls that were made to Decoder. Check the length with:
len(mockedDecoderFactory.DecoderCalls())
type DecoderMock ¶
type DecoderMock struct {
// DecodeFunc mocks the Decode method.
DecodeFunc func(data any) error
// contains filtered or unexported fields
}
DecoderMock is a mock implementation of utils.Decoder.
func TestSomethingThatUsesDecoder(t *testing.T) {
// make and configure a mocked utils.Decoder
mockedDecoder := &DecoderMock{
DecodeFunc: func(data any) error {
panic("mock out the Decode method")
},
}
// use mockedDecoder in code that requires utils.Decoder
// and then make assertions.
}
func (*DecoderMock) Decode ¶
func (mock *DecoderMock) Decode(data any) error
Decode calls DecodeFunc.
func (*DecoderMock) DecodeCalls ¶
func (mock *DecoderMock) DecodeCalls() []struct { Data any }
DecodeCalls gets all the calls that were made to Decode. Check the length with:
len(mockedDecoder.DecodeCalls())
type EncoderFactoryMock ¶
type EncoderFactoryMock struct {
// EncoderFunc mocks the Encoder method.
EncoderFunc func(w io.Writer) utils.Encoder
// contains filtered or unexported fields
}
EncoderFactoryMock is a mock implementation of utils.EncoderFactory.
func TestSomethingThatUsesEncoderFactory(t *testing.T) {
// make and configure a mocked utils.EncoderFactory
mockedEncoderFactory := &EncoderFactoryMock{
EncoderFunc: func(w io.Writer) utils.Encoder {
panic("mock out the Encoder method")
},
}
// use mockedEncoderFactory in code that requires utils.EncoderFactory
// and then make assertions.
}
func (*EncoderFactoryMock) Encoder ¶
func (mock *EncoderFactoryMock) Encoder(w io.Writer) utils.Encoder
Encoder calls EncoderFunc.
func (*EncoderFactoryMock) EncoderCalls ¶
func (mock *EncoderFactoryMock) EncoderCalls() []struct { W io.Writer }
EncoderCalls gets all the calls that were made to Encoder. Check the length with:
len(mockedEncoderFactory.EncoderCalls())
type EncoderMock ¶
type EncoderMock struct {
// EncodeFunc mocks the Encode method.
EncodeFunc func(data any) error
// SetEscapeHTMLFunc mocks the SetEscapeHTML method.
SetEscapeHTMLFunc func(escape bool)
// SetIndentFunc mocks the SetIndent method.
SetIndentFunc func(prefix string, indent string)
// contains filtered or unexported fields
}
EncoderMock is a mock implementation of utils.Encoder.
func TestSomethingThatUsesEncoder(t *testing.T) {
// make and configure a mocked utils.Encoder
mockedEncoder := &EncoderMock{
EncodeFunc: func(data any) error {
panic("mock out the Encode method")
},
SetEscapeHTMLFunc: func(escape bool) {
panic("mock out the SetEscapeHTML method")
},
SetIndentFunc: func(prefix string, indent string) {
panic("mock out the SetIndent method")
},
}
// use mockedEncoder in code that requires utils.Encoder
// and then make assertions.
}
func (*EncoderMock) Encode ¶
func (mock *EncoderMock) Encode(data any) error
Encode calls EncodeFunc.
func (*EncoderMock) EncodeCalls ¶
func (mock *EncoderMock) EncodeCalls() []struct { Data any }
EncodeCalls gets all the calls that were made to Encode. Check the length with:
len(mockedEncoder.EncodeCalls())
func (*EncoderMock) SetEscapeHTML ¶
func (mock *EncoderMock) SetEscapeHTML(escape bool)
SetEscapeHTML calls SetEscapeHTMLFunc.
func (*EncoderMock) SetEscapeHTMLCalls ¶
func (mock *EncoderMock) SetEscapeHTMLCalls() []struct { Escape bool }
SetEscapeHTMLCalls gets all the calls that were made to SetEscapeHTML. Check the length with:
len(mockedEncoder.SetEscapeHTMLCalls())
func (*EncoderMock) SetIndent ¶
func (mock *EncoderMock) SetIndent(prefix string, indent string)
SetIndent calls SetIndentFunc.
func (*EncoderMock) SetIndentCalls ¶
func (mock *EncoderMock) SetIndentCalls() []struct { Prefix string Indent string }
SetIndentCalls gets all the calls that were made to SetIndent. Check the length with:
len(mockedEncoder.SetIndentCalls())
type OsProxyMock ¶
type OsProxyMock struct {
// CreateFunc mocks the Create method.
CreateFunc func(name string) (*os.File, error)
// ExecutableFunc mocks the Executable method.
ExecutableFunc func() (string, error)
// FindProcessFunc mocks the FindProcess method.
FindProcessFunc func(pid int) (*os.Process, error)
// GetwdFunc mocks the Getwd method.
GetwdFunc func() (string, error)
// HostnameFunc mocks the Hostname method.
HostnameFunc func() (string, error)
// MkdirAllFunc mocks the MkdirAll method.
MkdirAllFunc func(name string, mode os.FileMode) error
// OpenFileFunc mocks the OpenFile method.
OpenFileFunc func(name string, flag int, perm os.FileMode) (*os.File, error)
// ReadFileIfExistsFunc mocks the ReadFileIfExists method.
ReadFileIfExistsFunc func(name string) (string, bool, error)
// RemoveFunc mocks the Remove method.
RemoveFunc func(name string) error
// StatFunc mocks the Stat method.
StatFunc func(pth string) (os.FileInfo, error)
// TempDirFunc mocks the TempDir method.
TempDirFunc func() string
// UserHomeDirFunc mocks the UserHomeDir method.
UserHomeDirFunc func() (string, error)
// WriteFileFunc mocks the WriteFile method.
WriteFileFunc func(name string, data []byte, mode os.FileMode) error
// contains filtered or unexported fields
}
OsProxyMock is a mock implementation of utils.OsProxy.
func TestSomethingThatUsesOsProxy(t *testing.T) {
// make and configure a mocked utils.OsProxy
mockedOsProxy := &OsProxyMock{
CreateFunc: func(name string) (*os.File, error) {
panic("mock out the Create method")
},
ExecutableFunc: func() (string, error) {
panic("mock out the Executable method")
},
FindProcessFunc: func(pid int) (*os.Process, error) {
panic("mock out the FindProcess method")
},
GetwdFunc: func() (string, error) {
panic("mock out the Getwd method")
},
HostnameFunc: func() (string, error) {
panic("mock out the Hostname method")
},
MkdirAllFunc: func(name string, mode os.FileMode) error {
panic("mock out the MkdirAll method")
},
OpenFileFunc: func(name string, flag int, perm os.FileMode) (*os.File, error) {
panic("mock out the OpenFile method")
},
ReadFileIfExistsFunc: func(name string) (string, bool, error) {
panic("mock out the ReadFileIfExists method")
},
RemoveFunc: func(name string) error {
panic("mock out the Remove method")
},
StatFunc: func(pth string) (os.FileInfo, error) {
panic("mock out the Stat method")
},
TempDirFunc: func() string {
panic("mock out the TempDir method")
},
UserHomeDirFunc: func() (string, error) {
panic("mock out the UserHomeDir method")
},
WriteFileFunc: func(name string, data []byte, mode os.FileMode) error {
panic("mock out the WriteFile method")
},
}
// use mockedOsProxy in code that requires utils.OsProxy
// and then make assertions.
}
func (*OsProxyMock) Create ¶
func (mock *OsProxyMock) Create(name string) (*os.File, error)
Create calls CreateFunc.
func (*OsProxyMock) CreateCalls ¶
func (mock *OsProxyMock) CreateCalls() []struct { Name string }
CreateCalls gets all the calls that were made to Create. Check the length with:
len(mockedOsProxy.CreateCalls())
func (*OsProxyMock) Executable ¶
func (mock *OsProxyMock) Executable() (string, error)
Executable calls ExecutableFunc.
func (*OsProxyMock) ExecutableCalls ¶
func (mock *OsProxyMock) ExecutableCalls() []struct { }
ExecutableCalls gets all the calls that were made to Executable. Check the length with:
len(mockedOsProxy.ExecutableCalls())
func (*OsProxyMock) FindProcess ¶
func (mock *OsProxyMock) FindProcess(pid int) (*os.Process, error)
FindProcess calls FindProcessFunc.
func (*OsProxyMock) FindProcessCalls ¶
func (mock *OsProxyMock) FindProcessCalls() []struct { Pid int }
FindProcessCalls gets all the calls that were made to FindProcess. Check the length with:
len(mockedOsProxy.FindProcessCalls())
func (*OsProxyMock) GetwdCalls ¶
func (mock *OsProxyMock) GetwdCalls() []struct { }
GetwdCalls gets all the calls that were made to Getwd. Check the length with:
len(mockedOsProxy.GetwdCalls())
func (*OsProxyMock) Hostname ¶
func (mock *OsProxyMock) Hostname() (string, error)
Hostname calls HostnameFunc.
func (*OsProxyMock) HostnameCalls ¶
func (mock *OsProxyMock) HostnameCalls() []struct { }
HostnameCalls gets all the calls that were made to Hostname. Check the length with:
len(mockedOsProxy.HostnameCalls())
func (*OsProxyMock) MkdirAll ¶
func (mock *OsProxyMock) MkdirAll(name string, mode os.FileMode) error
MkdirAll calls MkdirAllFunc.
func (*OsProxyMock) MkdirAllCalls ¶
func (mock *OsProxyMock) MkdirAllCalls() []struct { Name string Mode os.FileMode }
MkdirAllCalls gets all the calls that were made to MkdirAll. Check the length with:
len(mockedOsProxy.MkdirAllCalls())
func (*OsProxyMock) OpenFileCalls ¶
func (mock *OsProxyMock) OpenFileCalls() []struct { Name string Flag int Perm os.FileMode }
OpenFileCalls gets all the calls that were made to OpenFile. Check the length with:
len(mockedOsProxy.OpenFileCalls())
func (*OsProxyMock) ReadFileIfExists ¶
func (mock *OsProxyMock) ReadFileIfExists(name string) (string, bool, error)
ReadFileIfExists calls ReadFileIfExistsFunc.
func (*OsProxyMock) ReadFileIfExistsCalls ¶
func (mock *OsProxyMock) ReadFileIfExistsCalls() []struct { Name string }
ReadFileIfExistsCalls gets all the calls that were made to ReadFileIfExists. Check the length with:
len(mockedOsProxy.ReadFileIfExistsCalls())
func (*OsProxyMock) Remove ¶
func (mock *OsProxyMock) Remove(name string) error
Remove calls RemoveFunc.
func (*OsProxyMock) RemoveCalls ¶
func (mock *OsProxyMock) RemoveCalls() []struct { Name string }
RemoveCalls gets all the calls that were made to Remove. Check the length with:
len(mockedOsProxy.RemoveCalls())
func (*OsProxyMock) Stat ¶
func (mock *OsProxyMock) Stat(pth string) (os.FileInfo, error)
Stat calls StatFunc.
func (*OsProxyMock) StatCalls ¶
func (mock *OsProxyMock) StatCalls() []struct { Pth string }
StatCalls gets all the calls that were made to Stat. Check the length with:
len(mockedOsProxy.StatCalls())
func (*OsProxyMock) TempDirCalls ¶
func (mock *OsProxyMock) TempDirCalls() []struct { }
TempDirCalls gets all the calls that were made to TempDir. Check the length with:
len(mockedOsProxy.TempDirCalls())
func (*OsProxyMock) UserHomeDir ¶
func (mock *OsProxyMock) UserHomeDir() (string, error)
UserHomeDir calls UserHomeDirFunc.
func (*OsProxyMock) UserHomeDirCalls ¶
func (mock *OsProxyMock) UserHomeDirCalls() []struct { }
UserHomeDirCalls gets all the calls that were made to UserHomeDir. Check the length with:
len(mockedOsProxy.UserHomeDirCalls())
func (*OsProxyMock) WriteFileCalls ¶
func (mock *OsProxyMock) WriteFileCalls() []struct { Name string Data []byte Mode os.FileMode }
WriteFileCalls gets all the calls that were made to WriteFile. Check the length with:
len(mockedOsProxy.WriteFileCalls())