diff options
Diffstat (limited to 'src/mongo/unittest/death_test.h')
-rw-r--r-- | src/mongo/unittest/death_test.h | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/src/mongo/unittest/death_test.h b/src/mongo/unittest/death_test.h index a8391709dca..01ab994b70c 100644 --- a/src/mongo/unittest/death_test.h +++ b/src/mongo/unittest/death_test.h @@ -45,20 +45,21 @@ * in your death test, start them in the test body, or use DEATH_TEST_F and start them * in the setUp() method of the fixture. */ -#define DEATH_TEST(CASE_NAME, TEST_NAME, MATCH_EXPR) \ - class _TEST_TYPE_NAME(CASE_NAME, TEST_NAME) : public ::mongo::unittest::Test { \ - private: \ - virtual void _doTest(); \ - \ - static const RegistrationAgent< \ - ::mongo::unittest::DeathTest<_TEST_TYPE_NAME(CASE_NAME, TEST_NAME)>> _agent; \ - }; \ - const ::mongo::unittest::Test::RegistrationAgent<::mongo::unittest::DeathTest<_TEST_TYPE_NAME( \ - CASE_NAME, TEST_NAME)>> _TEST_TYPE_NAME(CASE_NAME, TEST_NAME)::_agent(#CASE_NAME, \ - #TEST_NAME); \ - std::string getDeathTestPattern(_TEST_TYPE_NAME(CASE_NAME, TEST_NAME)*) { \ - return MATCH_EXPR; \ - } \ +#define DEATH_TEST(CASE_NAME, TEST_NAME, MATCH_EXPR) \ + class _TEST_TYPE_NAME(CASE_NAME, TEST_NAME) : public ::mongo::unittest::Test { \ + private: \ + virtual void _doTest(); \ + \ + static const RegistrationAgent< \ + ::mongo::unittest::DeathTest<_TEST_TYPE_NAME(CASE_NAME, TEST_NAME)>> \ + _agent; \ + }; \ + const ::mongo::unittest::Test::RegistrationAgent< \ + ::mongo::unittest::DeathTest<_TEST_TYPE_NAME(CASE_NAME, TEST_NAME)>> \ + _TEST_TYPE_NAME(CASE_NAME, TEST_NAME)::_agent(#CASE_NAME, #TEST_NAME); \ + std::string getDeathTestPattern(_TEST_TYPE_NAME(CASE_NAME, TEST_NAME)*) { \ + return MATCH_EXPR; \ + } \ void _TEST_TYPE_NAME(CASE_NAME, TEST_NAME)::_doTest() /** @@ -67,20 +68,21 @@ * * See description of DEATH_TEST for more details on death tests. */ -#define DEATH_TEST_F(FIXTURE_NAME, TEST_NAME, MATCH_EXPR) \ - class _TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME) : public FIXTURE_NAME { \ - private: \ - virtual void _doTest(); \ - \ - static const RegistrationAgent< \ - ::mongo::unittest::DeathTest<_TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME)>> _agent; \ - }; \ - const ::mongo::unittest::Test::RegistrationAgent<::mongo::unittest::DeathTest<_TEST_TYPE_NAME( \ - FIXTURE_NAME, TEST_NAME)>> _TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME)::_agent(#FIXTURE_NAME, \ - #TEST_NAME); \ - std::string getDeathTestPattern(_TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME)*) { \ - return MATCH_EXPR; \ - } \ +#define DEATH_TEST_F(FIXTURE_NAME, TEST_NAME, MATCH_EXPR) \ + class _TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME) : public FIXTURE_NAME { \ + private: \ + virtual void _doTest(); \ + \ + static const RegistrationAgent< \ + ::mongo::unittest::DeathTest<_TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME)>> \ + _agent; \ + }; \ + const ::mongo::unittest::Test::RegistrationAgent< \ + ::mongo::unittest::DeathTest<_TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME)>> \ + _TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME)::_agent(#FIXTURE_NAME, #TEST_NAME); \ + std::string getDeathTestPattern(_TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME)*) { \ + return MATCH_EXPR; \ + } \ void _TEST_TYPE_NAME(FIXTURE_NAME, TEST_NAME)::_doTest() namespace mongo { @@ -104,8 +106,7 @@ public: static const std::string pattern; template <typename... Args> - DeathTest(Args&&... args) - : DeathTestImpl(stdx::make_unique<T>(std::forward<Args>(args)...)) {} + DeathTest(Args&&... args) : DeathTestImpl(stdx::make_unique<T>(std::forward<Args>(args)...)) {} private: std::string getPattern() override { |