-
Notifications
You must be signed in to change notification settings - Fork 320
Open
Description
Currently in tests/main.cpp, we are testing corner cases with a few SonicDBConfig functions, and we test that the string from the exception that is caught, matches an expected string.
https://github.com/sonic-net/sonic-swss-common/blob/master/tests/main.cpp#L71
However, this is not robust and better practice would be to test for what exception type is thrown as exception strings can be easily changed breaking the test or having to change in multiple locations.
https://github.com/sonic-net/sonic-swss-common/blob/master/common/dbconnector.cpp#L248
Here we see out_of_range exception thrown; we can use EXPECT_THROW instead to test that the same exception is thrown in our UT.
Metadata
Metadata
Assignees
Labels
No labels