From 7b30a5425eaf7aae1d72d5ba564092e342901fe8 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Fri, 25 Oct 2024 17:13:49 -0500 Subject: A lot of work on formatting. --- test/test_assert.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/test_assert.cpp') 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 -- cgit v1.2.3