From 89d5f086f8a9fc55036c71193f88bae17b5ac037 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 5 Mar 2026 15:00:02 +0100 Subject: [PATCH] Fix warning on MSVC --- test/test_iostream.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/test/test_iostream.cpp b/test/test_iostream.cpp index 5de28f92..b3a8c552 100644 --- a/test/test_iostream.cpp +++ b/test/test_iostream.cpp @@ -514,17 +514,23 @@ void test_console() TEST(std::getline(cin, line)); std::cout << "ASCII line read" << std::endl; // MinGW on CI sometimes swallows the (mocked) first line or returns it multiple times + DISABLE_CONST_EXPR_DETECTED if(isMinGW_CI && line == testStringIn2) + { + DISABLE_CONST_EXPR_DETECTED_POP std::cout << "WARNING: MinGW CI issue detected, skipping part of test"; // LCOV_EXCL_LINE - else + } else { TEST_EQ(line, testStringIn1); std::cout << "UTF-8 line read" << std::endl; line.clear(); TEST(std::getline(cin, line)); + DISABLE_CONST_EXPR_DETECTED if(isMinGW_CI && line == testStringIn1) + { + DISABLE_CONST_EXPR_DETECTED_POP std::cout << "WARNING: MinGW CI issue detected, skipping 1st part of test"; // LCOV_EXCL_LINE - else + } else TEST_EQ(line, testStringIn2); } } @@ -540,9 +546,12 @@ void test_console() cout << testString << std::flush; const auto data = stdoutHandle.getBufferData(); + DISABLE_CONST_EXPR_DETECTED if(isMinGW_CI && data.empty()) + { + DISABLE_CONST_EXPR_DETECTED_POP std::cout << "WARNING: MinGW CI issue detected, skipping part of test"; // LCOV_EXCL_LINE - else + } else TEST_EQ(data, nw::widen(testString)); } std::cout << "Test cerr console" << std::endl; @@ -557,9 +566,12 @@ void test_console() cerr << testString << std::flush; const auto data = stderrHandle.getBufferData(); + DISABLE_CONST_EXPR_DETECTED if(isMinGW_CI && data.empty()) + { + DISABLE_CONST_EXPR_DETECTED_POP std::cout << "WARNING: MinGW CI issue detected, skipping part of test"; // LCOV_EXCL_LINE - else + } else TEST_EQ(data, nw::widen(testString)); } std::cout << "Console tests done" << std::endl;