diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/cmtest/cmtest.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/internal/cmtest/cmtest.go b/internal/cmtest/cmtest.go new file mode 100644 index 0000000..a3454c6 --- /dev/null +++ b/internal/cmtest/cmtest.go @@ -0,0 +1,39 @@ +package cmtest + +import ( + "fmt" + + "github.com/eugenetriguba/checkmate" +) + +// MockT is a mock structure for capturing test outputs. +type MockT struct { + checkmate.TestingT + + FailNowCalled bool + FailCalled bool + Logs []string +} + +func (m *MockT) FailNow() { + m.FailNowCalled = true +} + +func (m *MockT) Fail() { + m.FailCalled = true +} + +func (m *MockT) Log(args ...any) { + m.Logs = append(m.Logs, fmt.Sprint(args...)) +} + +// MockHelperT has a MockT and is also a helperT. +type MockHelperT struct { + MockT + + HelperCalled bool +} + +func (m *MockHelperT) Helper() { + m.HelperCalled = true +} |