Antonboom / testifylint

The Golang linter that checks usage of github.com/stretchr/testify.
https://github.com/stretchr/testify
MIT License
101 stars 8 forks source link

empty: add string conversion #113

Closed ccoVeille closed 5 months ago

ccoVeille commented 5 months ago

This pattern should be detected

assert.Equal(t, "", string(ret.ReturnData))

Example: https://github.com/ipfs-force-community/go-fvm-sdk/blob/d49236897af1fdb5e0f7d29573fcbe1d29e2214d/sdk/cases/send.go#L42

The following code should be suggested

assert.Empty(t, ret.ReturnData)

This pattern is currently not detected, while it's pretty commonly used https://github.com/search?q=language%3Ago+%22assert.Equal%28t%2C+%5C%22%5C%22%2C+string%22&type=code

⚠️ I don't think we should do it for a struct with a stringer

Antonboom commented 5 months ago

@ccoVeille please, stop spam issues

merged with https://github.com/Antonboom/testifylint/issues/119