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,6 +18,7 @@
//==============================================================================
#include "util/LoggerFixtures.hpp"
#include "util/MockAssert.hpp"
#include "util/SignalsHandler.hpp"
#include "util/newconfig/ConfigDefinition.hpp"
#include "util/newconfig/ConfigValue.hpp"
@@ -64,7 +65,9 @@ protected:
bool testCanBeFinished_{false};
};
TEST(SignalsHandlerDeathTest, CantCreateTwoSignalsHandlers)
struct SignalsHandlerAssertTest : common::util::WithMockAssert {};
TEST_F(SignalsHandlerAssertTest, CantCreateTwoSignalsHandlers)
{
auto makeHandler = []() {
return SignalsHandler{
@@ -72,7 +75,7 @@ TEST(SignalsHandlerDeathTest, CantCreateTwoSignalsHandlers)
};
};
auto const handler = makeHandler();
EXPECT_DEATH({ makeHandler(); }, ".*");
EXPECT_CLIO_ASSERT_FAIL({ makeHandler(); });
}
struct SignalsHandlerTests : SignalsHandlerTestsBase {