microsoft / go-sqlcmd

The new sqlcmd, CLI for SQL Server and Azure SQL (winget install sqlcmd / sqlcmd create mssql / sqlcmd open ads)
https://learn.microsoft.com/sql/tools/sqlcmd/go-sqlcmd-utility
MIT License
323 stars 56 forks source link

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

Open stuartpa opened 1 year ago

stuartpa commented 1 year ago

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.

shueybubbles commented 1 year ago

why can't we just rely on stretchr asserts?