Closed maratori closed 6 months ago
Now I have to remember to add defer or t.Cleanup in each test manually.
defer
t.Cleanup
func TestSomething(t *testing.T) { formatterMock := NewFormatterMock(t) defer formatterMock.Finish() ... }
or
func TestSomething(t *testing.T) { formatterMock := NewFormatterMock(t) t.Cleanup(formatterMock.Finish) ... }
It would be great to do it automatically in mock constructor like gomock does. Of course only if it's go 1.14 or newer.
Hey @maratori
This is a really good proposal. It's available in v3.3.0. Please let me know if you find any issues with it.
Thank you!
Now I have to remember to add
defer
ort.Cleanup
in each test manually.or
It would be great to do it automatically in mock constructor like gomock does. Of course only if it's go 1.14 or newer.