flyingmutant / rapid

Rapid is a modern Go property-based testing library
https://pkg.go.dev/pgregory.net/rapid
Mozilla Public License 2.0
579 stars 25 forks source link

Would like for *rapid.T to implement the Cleanup function like *testing.T #62

Open nbgraham opened 1 year ago

nbgraham commented 1 year ago

From gomock:

// cleanuper is used to check if TestHelper also has the `Cleanup` method. A
// common pattern is to pass in a `*testing.T` to
// `NewController(t TestReporter)`. In Go 1.14+, `*testing.T` has a cleanup
// method. This can be utilized to call `Finish()` so the caller of this library
// does not have to.
type cleanuper interface {
    Cleanup(func())
}

I am using rapid with gomock and found some errors in my tests when I noticed that Finish was not being called on the mock controller after each Check