A test has failed when there is a failureMsg, if the value is not set, the test has passed
| 409 | |
| 410 | /// A test has failed when there is a failureMsg, if the value is not set, the test has passed |
| 411 | inline StreamSink createFullMessage( |
| 412 | UnitTestContext& ctx, |
| 413 | std::optional<std::string> failureMsg, |
| 414 | std::string_view userMsg, |
| 415 | bool isAssert, |
| 416 | std::string_view file, |
| 417 | int line |
| 418 | ) |
| 419 | { |
| 420 | if (!failureMsg) |
| 421 | return StreamSink(nullptr); |
| 422 | |
| 423 | if (++ctx.mNumFailures == kMaxTestFailures) |
| 424 | throw TooManyFailedTestsException(); |
| 425 | |
| 426 | StreamSink ss(&ctx); |
| 427 | ss << fmt::format("{}:{}:\nerror: {}", file, line, *failureMsg); |
| 428 | if (!userMsg.empty()) |
| 429 | ss << "\n" << userMsg; |
| 430 | if (isAssert) |
| 431 | throw AssertingTestException("Test asserted, couldn't continue."); |
| 432 | ss.setInsertNewLine(); |
| 433 | return ss; |
| 434 | } |
| 435 | |
| 436 | #define FTEST_ASSERT_RESULT true |
| 437 | #define FTEST_EXPECT_RESULT false |
nothing calls this directly
no test coverage detected