Skip to content

NewFoo(t TestingT): Not documented #1832

@guettli

Description

@guettli

The generated code contains this method:

// NewFoo creates a new instance of Foo. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewFoo(t interface {
	mock.TestingT
	Cleanup(func())
}) *Foo {

I use testify mock for several months now, and just found that.

There seems to be no documentation for that:

At least not here: https://pkg.go.dev/github.com/stretchr/testify/mock

And not here: https://github.com/stretchr/testify


Is there a reason for that? I think that method is very handy, because it lets your test fail, instead of getting a random panic in another goroutine if you have an error in On(...).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions