diff options
author | Andrew Morrow <acm@mongodb.com> | 2015-08-28 09:59:48 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2015-08-31 10:34:36 -0400 |
commit | a5960d1f2683f4debb732f5cf4042b6d6418ef84 (patch) | |
tree | bf660b6eaf4c722819487ea17b2b7cd8f29b1a7f /src/mongo/unittest | |
parent | 518118bfce4da06e6c26063e125f90e30a1b3baa (diff) | |
download | mongo-a5960d1f2683f4debb732f5cf4042b6d6418ef84.tar.gz |
SERVER-19769 Use std::function to back stdx::function on windows
While std::function has some broken edge cases on VS2013, so does
boost::function in boost 1.56. Rather than upgrade boost, use MSVC's
std::function and fix up the few places that need adjustment.
Diffstat (limited to 'src/mongo/unittest')
-rw-r--r-- | src/mongo/unittest/unittest.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mongo/unittest/unittest.h b/src/mongo/unittest/unittest.h index aea8faa8f8b..9c40621b3a4 100644 --- a/src/mongo/unittest/unittest.h +++ b/src/mongo/unittest/unittest.h @@ -126,13 +126,12 @@ * Behaves like ASSERT_THROWS, above, but also fails if calling what() on the thrown exception * does not return a string equal to EXPECTED_WHAT. */ -#define ASSERT_THROWS_WHAT(STATEMENT, EXCEPTION_TYPE, EXPECTED_WHAT) \ - ASSERT_THROWS_PRED(STATEMENT, \ - EXCEPTION_TYPE, \ - ::mongo::stdx::bind(std::equal_to<std::string>(), \ - (EXPECTED_WHAT), \ - ::mongo::stdx::bind(&EXCEPTION_TYPE::what, \ - ::mongo::stdx::placeholders::_1))) +#define ASSERT_THROWS_WHAT(STATEMENT, EXCEPTION_TYPE, EXPECTED_WHAT) \ + ASSERT_THROWS_PRED(STATEMENT, \ + EXCEPTION_TYPE, \ + ([&](const EXCEPTION_TYPE& ex) { \ + return ::mongo::StringData(ex.what()) == ::mongo::StringData(EXPECTED_WHAT); \ + })) /** * Behaves like ASSERT_THROWS, above, but also fails if calling getCode() on the thrown exception |