Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assert/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,9 @@ type CollectT struct {
errors []error
}

// Helper is like [testing.T.Helper] but does nothing.
func (CollectT) Helper() {}

// Errorf collects the error.
func (c *CollectT) Errorf(format string, args ...interface{}) {
c.errors = append(c.errors, fmt.Errorf(format, args...))
Expand Down
17 changes: 15 additions & 2 deletions assert/assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,9 @@ type bufferT struct {
buf bytes.Buffer
}

// Helper is like [testing.T.Helper] but does nothing.
func (bufferT) Helper() {}

func (t *bufferT) Errorf(format string, args ...interface{}) {
// implementation of decorate is copied from testing.T
decorate := func(s string) string {
Expand Down Expand Up @@ -2791,6 +2794,9 @@ type mockTestingT struct {
args []interface{}
}

// Helper is like [testing.T.Helper] but does nothing.
func (mockTestingT) Helper() {}

func (m *mockTestingT) errorString() string {
return fmt.Sprintf(m.errorFmt, m.args...)
}
Expand All @@ -2816,6 +2822,9 @@ func TestFailNowWithPlainTestingT(t *testing.T) {

type mockFailNowTestingT struct{}

// Helper is like [testing.T.Helper] but does nothing.
func (mockFailNowTestingT) Helper() {}

func (m *mockFailNowTestingT) Errorf(format string, args ...interface{}) {}

func (m *mockFailNowTestingT) FailNow() {}
Expand Down Expand Up @@ -3141,12 +3150,13 @@ type errorsCapturingT struct {
errors []error
}

// Helper is like [testing.T.Helper] but does nothing.
func (errorsCapturingT) Helper() {}

func (t *errorsCapturingT) Errorf(format string, args ...interface{}) {
t.errors = append(t.errors, fmt.Errorf(format, args...))
}

func (t *errorsCapturingT) Helper() {}

func TestEventuallyWithTFalse(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -3393,6 +3403,9 @@ type captureTestingT struct {
msg string
}

// Helper is like [testing.T.Helper] but does nothing.
func (captureTestingT) Helper() {}

func (ctt *captureTestingT) Errorf(format string, args ...interface{}) {
ctt.msg = fmt.Sprintf(format, args...)
ctt.failed = true
Expand Down
3 changes: 3 additions & 0 deletions mock/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ type MockTestingT struct {
logfCount, errorfCount, failNowCount int
}

// Helper is like [testing.T.Helper] but does nothing.
func (MockTestingT) Helper() {}

const mockTestingTFailNowCalled = "FailNow was called"

func (m *MockTestingT) Logf(string, ...interface{}) {
Expand Down
3 changes: 3 additions & 0 deletions require/requirements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type MockT struct {
Failed bool
}

// Helper is like [testing.T.Helper] but does nothing.
func (MockT) Helper() {}

func (t *MockT) FailNow() {
t.Failed = true
}
Expand Down