Skip to content

Commit e47ad71

Browse files
author
Omer Bulut
committed
fix: suppress warning messages in ErrorHandling test for clean CI/CD output
1 parent 3cf57c6 commit e47ad71

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

LoggerTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,11 @@ TEST_F(LoggerTest, MultiThreadedLogging) {
270270

271271
// Test 9: Error handling
272272
TEST_F(LoggerTest, ErrorHandling) {
273+
// Redirect stderr to suppress warning messages during this test
274+
std::stringstream buffer;
275+
std::streambuf* old_stderr = std::cerr.rdbuf();
276+
std::cerr.rdbuf(buffer.rdbuf());
277+
273278
Logger::Config config;
274279
config.logFilePath = "/invalid/path/test.log"; // Geçersiz path
275280
config.consoleOutput = true;
@@ -279,6 +284,13 @@ TEST_F(LoggerTest, ErrorHandling) {
279284
Logger logger(config);
280285
logger.info("Test message");
281286
});
287+
288+
// Restore stderr
289+
std::cerr.rdbuf(old_stderr);
290+
291+
// Verify that warning was captured (optional verification)
292+
std::string captured = buffer.str();
293+
EXPECT_TRUE(captured.find("Warning: Could not create log file") != std::string::npos);
282294
}
283295

284296
// Test 10: Flush functionality (simplified)

0 commit comments

Comments
 (0)