diff --git a/test/test.hpp b/test/test.hpp index cabf1e618..609685350 100644 --- a/test/test.hpp +++ b/test/test.hpp @@ -52,8 +52,19 @@ void report_failure(char const* str, char const* file, int line); report_failure(x, line, file) #define TEST_CHECK(x) \ - if (!(x)) \ - TEST_REPORT_AUX("TEST_CHECK failed: \"" #x "\"", __FILE__, __LINE__) + try \ + { \ + if (!(x)) \ + TEST_REPORT_AUX("TEST_CHECK failed: \"" #x "\"", __FILE__, __LINE__); \ + } \ + catch (std::exception& e) \ + { \ + TEST_ERROR("Exception thrown: " #x " :" + std::string(e.what())); \ + } \ + catch (...) \ + { \ + TEST_ERROR("Exception thrown: " #x); \ + } #define TEST_ERROR(x) \ TEST_REPORT_AUX((std::string("ERROR: \"") + x + "\"").c_str(), __FILE__, __LINE__)