@@ -202,7 +202,7 @@ class http_asserts
202202#define HTTP_ERROR_CHECK_IMPL (__code ) VERIFY_ARE_EQUAL(static_cast <int >(__code), _exc.error_code().default_error_condition().value());
203203#endif
204204#else
205- #define HTTP_ERROR_CHECK_IMPL (__code ) if (__code != _exc.error_code()) { VERIFY_IS_TRUE ( false , " Unexpected error code encountered." ); }
205+ #define HTTP_ERROR_CHECK_IMPL (__code ) VERIFY_ARE_EQUAL( _exc.error_code(), __code , " Unexpected error code encountered." )
206206#endif
207207
208208
@@ -212,17 +212,20 @@ class http_asserts
212212 try \
213213 { \
214214 __expression; \
215- VERIFY_IS_TRUE ( false , " Expected http_exception not thrown" ); \
215+ UnitTest::CurrentTest::Results ()-> OnTestFailure ( UnitTest::TestDetails (* UnitTest::CurrentTest::Details (), __LINE__), " Expected exception: \" web::http:: http_exception\" not thrown" ); \
216216 } \
217217 catch (const web::http::http_exception& _exc) \
218218 { \
219219 VERIFY_IS_TRUE (std::string (_exc.what ()).size () > 0 ); \
220220 HTTP_ERROR_CHECK_IMPL (__code); \
221- } \
222- catch (...) \
223- { \
224- VERIFY_IS_TRUE (false , " Exception other than http_exception thrown" ); \
225- } \
221+ } catch (const std::exception & _exc) { \
222+ std::string _msg (" (" #__expression " ) threw exception: " ); \
223+ _msg.append (_exc.what ()); \
224+ UnitTest::CurrentTest::Results ()->OnTestFailure (UnitTest::TestDetails (*UnitTest::CurrentTest::Details (), __LINE__), _msg.c_str ()); \
225+ } catch (...) { \
226+ std::string _msg (" (" #__expression " ) threw exception: <...>" ); \
227+ UnitTest::CurrentTest::Results ()->OnTestFailure (UnitTest::TestDetails (*UnitTest::CurrentTest::Details (), __LINE__), _msg.c_str ()); \
228+ } \
226229 UNITTEST_MULTILINE_MACRO_END
227230
228231}}}}
0 commit comments