Make`assert.Zero` harder to misuse
Firstly, thank you for this excellent library! I'm slowly migrating my projects from stretchr/testify to alecthomas/assert.
What's wrong with this code?
assert.Zero(t, 0, len(foo), "foo should have length zero")
Spoiler alert: this test always passes, no matter how big len(foo) is.
Is there a way to make this API harder to misuse?
Aren't you calling it wrong, though? There's no expected value for that function, it's assumed to be whatever the zero value is for the type. Or do you mean that it's easy to accidentally call incorrectly and then end up with a test that always passes?
Oh, I guess this also ought to fix your case... https://github.com/alecthomas/assert/commit/929325d69bc1ce5d5c57cf1ccf58dc524d0557dc
Or do you mean that it's easy to accidentally call incorrectly and then end up with a test that always passes?
Exactly. Your fix looks great, thank you!
Closing due to inactivity.