|
28 | 28 |
|
29 | 29 | #define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
|
30 | 30 |
|
| 31 | +#include "mongo/config.h" |
31 | 32 | #include "mongo/platform/basic.h"
|
32 | 33 |
|
33 | 34 | #include <type_traits>
|
@@ -314,7 +315,6 @@ DEATH_TEST(InvariantTerminationTest,
|
314 | 315 | invariant(false, msg);
|
315 | 316 | }
|
316 | 317 |
|
317 |
| - |
318 | 318 | DEATH_TEST(InvariantTerminationTest,
|
319 | 319 | invariantOverloadWithStringLiteralMsg,
|
320 | 320 | "Terminating with string literal invariant message") {
|
@@ -346,6 +346,31 @@ DEATH_TEST(InvariantTerminationTest,
|
346 | 346 | msg);
|
347 | 347 | }
|
348 | 348 |
|
| 349 | +#if defined(MONGO_CONFIG_DEBUG_BUILD) |
| 350 | +// dassert and its friends |
| 351 | +DEATH_TEST(DassertTerminationTest, invariant, "Invariant failure false " __FILE__) { |
| 352 | + dassert(false); |
| 353 | +} |
| 354 | + |
| 355 | +DEATH_TEST(DassertTerminationTest, dassertOK, "Terminating with dassertOK") { |
| 356 | + dassert(Status(ErrorCodes::InternalError, "Terminating with dassertOK")); |
| 357 | +} |
| 358 | + |
| 359 | +DEATH_TEST(DassertTerminationTest, |
| 360 | + invariantWithStringLiteralMsg, |
| 361 | + "Terminating with string literal dassert message") { |
| 362 | + const char* msg = "Terminating with string literal dassert message"; |
| 363 | + dassert(false, msg); |
| 364 | +} |
| 365 | + |
| 366 | +DEATH_TEST(DassertTerminationTest, |
| 367 | + dassertWithStdStringMsg, |
| 368 | + "Terminating with std::string dassert message: 12345") { |
| 369 | + const std::string msg = str::stream() << "Terminating with std::string dassert message: " |
| 370 | + << 12345; |
| 371 | + dassert(false, msg); |
| 372 | +} |
| 373 | +#endif // defined(MONGO_CONFIG_DEBUG_BUILD) |
349 | 374 |
|
350 | 375 | } // namespace
|
351 | 376 | } // namespace mongo
|
0 commit comments