go-sqlcmd icon indicating copy to clipboard operation
go-sqlcmd copied to clipboard

Pattern used for catching expected errors in tests should be able to verify for precise expected error

Open stuartpa opened this issue 2 years ago • 1 comments

I've been using this pattern for negative tests, that are expecting a failure:

defer func() { test.CatchExpectedError(recover(), t) }()

This pattern ends up causing a test to pass for any error, even an error that is an error in the test itself.

Invent a pattern that ensures tests don't accidentally pass because the test itself is throwing an error.

stuartpa avatar Dec 09 '22 10:12 stuartpa