diff options
author | Benety Goh <benety@mongodb.com> | 2018-04-26 14:51:34 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2018-04-26 14:51:53 -0400 |
commit | 681d1e0bf8d45c366848678811bad6f1a471f20c (patch) | |
tree | b29f55652cb4ce537be804ce3c036a8147044c7a /src/mongo/util | |
parent | 859ed95a67e244c0f747a410450137b0cb7b4ce9 (diff) | |
download | mongo-681d1e0bf8d45c366848678811bad6f1a471f20c.tar.gz |
SERVER-34364 add test coverage for dassert macror3.7.9
Diffstat (limited to 'src/mongo/util')
-rw-r--r-- | src/mongo/util/assert_util_test.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/mongo/util/assert_util_test.cpp b/src/mongo/util/assert_util_test.cpp index c7f930aea92..bf99f856563 100644 --- a/src/mongo/util/assert_util_test.cpp +++ b/src/mongo/util/assert_util_test.cpp @@ -28,6 +28,7 @@ #define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault +#include "mongo/config.h" #include "mongo/platform/basic.h" #include <type_traits> @@ -314,7 +315,6 @@ DEATH_TEST(InvariantTerminationTest, invariant(false, msg); } - DEATH_TEST(InvariantTerminationTest, invariantOverloadWithStringLiteralMsg, "Terminating with string literal invariant message") { @@ -346,6 +346,31 @@ DEATH_TEST(InvariantTerminationTest, msg); } +#if defined(MONGO_CONFIG_DEBUG_BUILD) +// dassert and its friends +DEATH_TEST(DassertTerminationTest, invariant, "Invariant failure false " __FILE__) { + dassert(false); +} + +DEATH_TEST(DassertTerminationTest, dassertOK, "Terminating with dassertOK") { + dassert(Status(ErrorCodes::InternalError, "Terminating with dassertOK")); +} + +DEATH_TEST(DassertTerminationTest, + invariantWithStringLiteralMsg, + "Terminating with string literal dassert message") { + const char* msg = "Terminating with string literal dassert message"; + dassert(false, msg); +} + +DEATH_TEST(DassertTerminationTest, + dassertWithStdStringMsg, + "Terminating with std::string dassert message: 12345") { + const std::string msg = str::stream() << "Terminating with std::string dassert message: " + << 12345; + dassert(false, msg); +} +#endif // defined(MONGO_CONFIG_DEBUG_BUILD) } // namespace } // namespace mongo |