boostorg / test

The reference C++ unit testing framework (TDD, xUnit, C++03/11/14/17)
http://boost.org/libs/test
Boost Software License 1.0
182 stars 141 forks source link

Report the exception text from BOOST_CHECK_NO_THROW #423

Open ujos opened 3 months ago

ujos commented 3 months ago

Source: https://stackoverflow.com/questions/15133259/boost-check-no-throw-how-to-get-exception-message-printed

When I test a method using

BOOST_CHECK_NO_THROW( method_to_test() );

and an exception is thrown, it displays that an exception was thrown, but never the exception's message like this:

test.cpp(14): error in "test": incorrect exception my_exception is caught

Is it possible to print the exception message as well, i.e. the string returned by my_exception.what()? my_exception is derived from std::exception and overloads what().