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(format string, args ...any) (int, error)
// contains filtered or unexported fields
}
LoggerMock is a mock implementation of git.Logger.
func TestSomethingThatUsesLogger(t *testing.T) {
// make and configure a mocked git.Logger
mockedLogger := &LoggerMock{
PrintfFunc: func(format string, args ...any) (int, error) {
panic("mock out the Printf method")
},
}
// use mockedLogger in code that requires git.Logger
// and then make assertions.
}
func (*LoggerMock) Printf ¶
func (mock *LoggerMock) Printf(format string, args ...any) (int, error)
Printf calls PrintfFunc.
func (*LoggerMock) PrintfCalls ¶
func (mock *LoggerMock) PrintfCalls() []struct { Format string Args []any }
PrintfCalls gets all the calls that were made to Printf. Check the length with:
len(mockedLogger.PrintfCalls())
Click to show internal directories.
Click to hide internal directories.