diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-10-25 17:13:49 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-10-25 17:13:49 -0500 |
commit | 7b30a5425eaf7aae1d72d5ba564092e342901fe8 (patch) | |
tree | 8a74d0810ea4db23d4d0c6c4ba8d91518d569db2 /test/test_assert.cpp | |
parent | 11968f674a7de34fb7de744598a8086330cd88a3 (diff) |
A lot of work on formatting.
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 |