Documentation
¶
Index ¶
- type LoggerMock
- func (mock *LoggerMock) LogAnswer(answer string)
- func (mock *LoggerMock) LogAnswerCalls() []struct{ ... }
- func (mock *LoggerMock) LogDraftReview(action string, feedback string)
- func (mock *LoggerMock) LogDraftReviewCalls() []struct{ ... }
- func (mock *LoggerMock) LogQuestion(question string, options []string)
- func (mock *LoggerMock) LogQuestionCalls() []struct{ ... }
- func (mock *LoggerMock) Path() string
- func (mock *LoggerMock) PathCalls() []struct{}
- func (mock *LoggerMock) Print(format string, args ...any)
- func (mock *LoggerMock) PrintAligned(text string)
- func (mock *LoggerMock) PrintAlignedCalls() []struct{ ... }
- func (mock *LoggerMock) PrintCalls() []struct{ ... }
- func (mock *LoggerMock) PrintRaw(format string, args ...any)
- func (mock *LoggerMock) PrintRawCalls() []struct{ ... }
- func (mock *LoggerMock) PrintSection(section status.Section)
- func (mock *LoggerMock) PrintSectionCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggerMock ¶
type LoggerMock struct {
// LogAnswerFunc mocks the LogAnswer method.
LogAnswerFunc func(answer string)
// LogDraftReviewFunc mocks the LogDraftReview method.
LogDraftReviewFunc func(action string, feedback string)
// LogQuestionFunc mocks the LogQuestion method.
LogQuestionFunc func(question string, options []string)
// PathFunc mocks the Path method.
PathFunc func() string
// PrintFunc mocks the Print method.
PrintFunc func(format string, args ...any)
// PrintAlignedFunc mocks the PrintAligned method.
PrintAlignedFunc func(text string)
// PrintRawFunc mocks the PrintRaw method.
PrintRawFunc func(format string, args ...any)
// PrintSectionFunc mocks the PrintSection method.
PrintSectionFunc func(section status.Section)
// contains filtered or unexported fields
}
LoggerMock is a mock implementation of web.Logger.
func TestSomethingThatUsesLogger(t *testing.T) {
// make and configure a mocked web.Logger
mockedLogger := &LoggerMock{
LogAnswerFunc: func(answer string) {
panic("mock out the LogAnswer method")
},
LogDraftReviewFunc: func(action string, feedback string) {
panic("mock out the LogDraftReview method")
},
LogQuestionFunc: func(question string, options []string) {
panic("mock out the LogQuestion method")
},
PathFunc: func() string {
panic("mock out the Path method")
},
PrintFunc: func(format string, args ...any) {
panic("mock out the Print method")
},
PrintAlignedFunc: func(text string) {
panic("mock out the PrintAligned method")
},
PrintRawFunc: func(format string, args ...any) {
panic("mock out the PrintRaw method")
},
PrintSectionFunc: func(section status.Section) {
panic("mock out the PrintSection method")
},
}
// use mockedLogger in code that requires web.Logger
// and then make assertions.
}
func (*LoggerMock) LogAnswer ¶
func (mock *LoggerMock) LogAnswer(answer string)
LogAnswer calls LogAnswerFunc.
func (*LoggerMock) LogAnswerCalls ¶
func (mock *LoggerMock) LogAnswerCalls() []struct { Answer string }
LogAnswerCalls gets all the calls that were made to LogAnswer. Check the length with:
len(mockedLogger.LogAnswerCalls())
func (*LoggerMock) LogDraftReview ¶
func (mock *LoggerMock) LogDraftReview(action string, feedback string)
LogDraftReview calls LogDraftReviewFunc.
func (*LoggerMock) LogDraftReviewCalls ¶
func (mock *LoggerMock) LogDraftReviewCalls() []struct { Action string Feedback string }
LogDraftReviewCalls gets all the calls that were made to LogDraftReview. Check the length with:
len(mockedLogger.LogDraftReviewCalls())
func (*LoggerMock) LogQuestion ¶
func (mock *LoggerMock) LogQuestion(question string, options []string)
LogQuestion calls LogQuestionFunc.
func (*LoggerMock) LogQuestionCalls ¶
func (mock *LoggerMock) LogQuestionCalls() []struct { Question string Options []string }
LogQuestionCalls gets all the calls that were made to LogQuestion. Check the length with:
len(mockedLogger.LogQuestionCalls())
func (*LoggerMock) PathCalls ¶
func (mock *LoggerMock) PathCalls() []struct { }
PathCalls gets all the calls that were made to Path. Check the length with:
len(mockedLogger.PathCalls())
func (*LoggerMock) Print ¶
func (mock *LoggerMock) Print(format string, args ...any)
Print calls PrintFunc.
func (*LoggerMock) PrintAligned ¶
func (mock *LoggerMock) PrintAligned(text string)
PrintAligned calls PrintAlignedFunc.
func (*LoggerMock) PrintAlignedCalls ¶
func (mock *LoggerMock) PrintAlignedCalls() []struct { Text string }
PrintAlignedCalls gets all the calls that were made to PrintAligned. Check the length with:
len(mockedLogger.PrintAlignedCalls())
func (*LoggerMock) PrintCalls ¶
func (mock *LoggerMock) PrintCalls() []struct { Format string Args []any }
PrintCalls gets all the calls that were made to Print. Check the length with:
len(mockedLogger.PrintCalls())
func (*LoggerMock) PrintRaw ¶
func (mock *LoggerMock) PrintRaw(format string, args ...any)
PrintRaw calls PrintRawFunc.
func (*LoggerMock) PrintRawCalls ¶
func (mock *LoggerMock) PrintRawCalls() []struct { Format string Args []any }
PrintRawCalls gets all the calls that were made to PrintRaw. Check the length with:
len(mockedLogger.PrintRawCalls())
func (*LoggerMock) PrintSection ¶
func (mock *LoggerMock) PrintSection(section status.Section)
PrintSection calls PrintSectionFunc.
func (*LoggerMock) PrintSectionCalls ¶
func (mock *LoggerMock) PrintSectionCalls() []struct { Section status.Section }
PrintSectionCalls gets all the calls that were made to PrintSection. Check the length with:
len(mockedLogger.PrintSectionCalls())