testify icon indicating copy to clipboard operation
testify copied to clipboard

suite: missing signature check before calling Test* method

Open wvell opened this issue 7 months ago • 3 comments

If a test method on a suite has a parameter there is a panic:

func (suite *SomeTestSuite) TestUpdateSomething(somearg string) {
......
}

When running this you get the following panic:

suite.go:87: test panicked: reflect: Call with too few input arguments
....

I think the error handling could be more clear here. Something like "method TestUpdateSomething on SomeTestSuite contains arguments"

Here is the go.dev link: https://go.dev/play/p/cNNfqH5QpeQ

I can create a pull request if this change is wanted?

Edit: Some more context. I run into this problem when I am porting old test methods to a suite.

wvell avatar Nov 16 '23 09:11 wvell