diff options
Diffstat (limited to 'test/test_assert.cpp')
-rw-r--r-- | test/test_assert.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_assert.cpp b/test/test_assert.cpp index 1f95388..5129b97 100644 --- a/test/test_assert.cpp +++ b/test/test_assert.cpp @@ -18,6 +18,7 @@ #include "fud_assert.hpp" #include "gtest/gtest.h" +#include "gmock/gmock.h" namespace fud { @@ -26,4 +27,17 @@ TEST(AssertTest, AssertFud) EXPECT_EXIT(fudAssert(false), ::testing::KilledBySignal(SIGABRT), ".*"); } +TEST(AssertTest, AssertFudMessage) +{ + testing::internal::CaptureStderr(); + auto sourceLoc = std::source_location::current(); + constexpr const char* assertMessage = "Artificial Message"; + impl::assertFailMessage(assertMessage, sourceLoc); + auto message = testing::internal::GetCapturedStderr(); + EXPECT_THAT(message, testing::HasSubstr(sourceLoc.file_name())); + EXPECT_THAT(message, testing::HasSubstr(sourceLoc.function_name())); + EXPECT_THAT(message, testing::HasSubstr(std::to_string(sourceLoc.line()))); + EXPECT_THAT(message, testing::HasSubstr(assertMessage)); +} + } // namespace fud |