You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go 1.19 discovered a minor flaw in our tests in #129: second argument to errors.As should not be *error
Changing the type of expectedErr in our test table to interface{} silenced that error for now but defeated the purpose of testing if the function throws the correct error. So currently, any error (or even any non nil value) will make the test pass.
Proposal
There are a couple of different solutions to solve this:
compare string representations, i.e. given.Error() == expected.Error()
use reflection
avoid table tests altogether
include a pointer to a function which takes an error and returns a boolean
The text was updated successfully, but these errors were encountered:
Go 1.19 discovered a minor flaw in our tests in #129:
second argument to errors.As should not be *error
Changing the type of
expectedErr
in our test table tointerface{}
silenced that error for now but defeated the purpose of testing if the function throws the correct error. So currently, any error (or even any nonnil
value) will make the test pass.Proposal
There are a couple of different solutions to solve this:
The text was updated successfully, but these errors were encountered: