test: Add assert mock to avoid death tests (#1947)

Fixes #1750
This commit is contained in:
Sergey Kuznetsov
2025-03-07 18:11:52 +00:00
committed by GitHub
parent 8a08c5e6ce
commit c57fe1e6e4
30 changed files with 411 additions and 295 deletions

View File

@@ -18,15 +18,18 @@
//==============================================================================
#include "util/Assert.hpp"
#include "util/MockAssert.hpp"
#include <gtest/gtest.h>
TEST(AssertTests, assertTrue)
struct AssertTest : common::util::WithMockAssert {};
TEST_F(AssertTest, assertTrue)
{
EXPECT_NO_THROW(ASSERT(true, "Should not fail"));
}
TEST(AssertDeathTest, assertFalse)
TEST_F(AssertTest, assertFalse)
{
EXPECT_DEATH({ ASSERT(false, "failure"); }, ".*");
EXPECT_CLIO_ASSERT_FAIL({ ASSERT(false, "failure"); });
}