@@ -202,7 +202,7 @@ class http_asserts
202
202
#define HTTP_ERROR_CHECK_IMPL (__code ) VERIFY_ARE_EQUAL(static_cast <int >(__code), _exc.error_code().default_error_condition().value());
203
203
#endif
204
204
#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." )
206
206
#endif
207
207
208
208
@@ -212,17 +212,20 @@ class http_asserts
212
212
try \
213
213
{ \
214
214
__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" ); \
216
216
} \
217
217
catch (const web::http::http_exception& _exc) \
218
218
{ \
219
219
VERIFY_IS_TRUE (std::string (_exc.what ()).size () > 0 ); \
220
220
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
+ } \
226
229
UNITTEST_MULTILINE_MACRO_END
227
230
228
231
}}}}
0 commit comments