Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Ignore return value of getchar when waiting for keypress

Previously this was causing warnings under MSVC for ignored return
value.
Commit
a7a9be59ff9998afc3eff06300fba34cc89d4c5e
Author
Martin Hořeňovský ·
Parents
cb2fceb11982

Files · Download .tar.gz

Changes

 include/catch_session.hpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/catch_session.hpp b/include/catch_session.hpp
index 1968cb2f..a423a3be 100644
--- a/include/catch_session.hpp
+++ b/include/catch_session.hpp
@@ -201,12 +201,12 @@ namespace Catch {
         int run() {
             if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
                 Catch::cout() << "...waiting for enter/ return before starting" << std::endl;
-                std::getchar();
+                static_cast<void>(std::getchar());
             }
             int exitCode = runInternal();
             if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
                 Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl;
-                std::getchar();
+                static_cast<void>(std::getchar());
             }
             return exitCode;
         }