Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggerMock ¶
type LoggerMock struct {
// PrintfFunc mocks the Printf method.
PrintfFunc func(s string, args ...interface{})
// SubFunc mocks the Sub method.
SubFunc func(p string) Logger
// contains filtered or unexported fields
}
LoggerMock is a mock implementation of Logger.
func TestSomethingThatUsesLogger(t *testing.T) {
// make and configure a mocked Logger
mockedLogger := &LoggerMock{
PrintfFunc: func(s string, args ...interface{}) {
panic("mock out the Printf method")
},
SubFunc: func(p string) Logger {
panic("mock out the Sub method")
},
}
// use mockedLogger in code that requires Logger
// and then make assertions.
}
func (*LoggerMock) Printf ¶
func (mock *LoggerMock) Printf(s string, args ...interface{})
Printf calls PrintfFunc.
func (*LoggerMock) PrintfCalls ¶
func (mock *LoggerMock) PrintfCalls() []struct { S string Args []interface{} }
PrintfCalls gets all the calls that were made to Printf. Check the length with:
len(mockedLogger.PrintfCalls())
func (*LoggerMock) SubCalls ¶
func (mock *LoggerMock) SubCalls() []struct { P string }
SubCalls gets all the calls that were made to Sub. Check the length with:
len(mockedLogger.SubCalls())
Click to show internal directories.
Click to hide internal directories.