If I have user defined exceptions in my code, I can't get Boost test to consider them as failures.
For example,
BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(MyTest,1)
BOOST_AUTO_TEST_CASE(MyTest)
{
// code which throws user defined exception, not derived from std::exception.
}
I get a generic message:
Caught exception: ....
unknown location(0):....
It does not recognize this error as a failure since it is not a std::exception. So it does not honor the expected_failures clause.
How do I enforce that the piece of code should always throw an exception? THis seems to be a useful thing to want. In case future code changes cause the code to pass and the exception is not thrown, I want to know that.