mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Add command line option 'never' to --wait-for-keypress (#1866)
Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
This commit is contained in:
		
				
					committed by
					
						
						Martin Hořeňovský
					
				
			
			
				
	
			
			
			
						parent
						
							2441c2faab
						
					
				
				
					commit
					6a2c025bfc
				
			@@ -10,6 +10,7 @@
 | 
			
		||||
#include <catch2/catch_test_case_info.h>
 | 
			
		||||
#include <catch2/catch_config.hpp>
 | 
			
		||||
#include <catch2/catch_commandline.h>
 | 
			
		||||
#include <catch2/catch_generators.hpp>
 | 
			
		||||
 | 
			
		||||
#ifdef __clang__
 | 
			
		||||
#   pragma clang diagnostic ignored "-Wc++98-compat"
 | 
			
		||||
@@ -410,7 +411,31 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
 | 
			
		||||
            CHECK(!result);
 | 
			
		||||
            REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
     SECTION("wait-for-keypress") {
 | 
			
		||||
        SECTION("Accepted options") {
 | 
			
		||||
            using tuple_type = std::tuple<char const*, Catch::WaitForKeypress::When>;
 | 
			
		||||
            auto input = GENERATE(table<char const*, Catch::WaitForKeypress::When>({
 | 
			
		||||
                tuple_type{"never", Catch::WaitForKeypress::Never},
 | 
			
		||||
                tuple_type{"start", Catch::WaitForKeypress::BeforeStart},
 | 
			
		||||
                tuple_type{"exit",  Catch::WaitForKeypress::BeforeExit},
 | 
			
		||||
                tuple_type{"both",  Catch::WaitForKeypress::BeforeStartAndExit},
 | 
			
		||||
            }));
 | 
			
		||||
            CHECK(cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}));
 | 
			
		||||
 | 
			
		||||
            REQUIRE(config.waitForKeypress == std::get<1>(input));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        SECTION("invalid options are reported") {
 | 
			
		||||
            auto result = cli.parse({"test", "--wait-for-keypress", "sometimes"});
 | 
			
		||||
            CHECK(!result);
 | 
			
		||||
 | 
			
		||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
 | 
			
		||||
            REQUIRE_THAT(result.errorMessage(), Contains("never") && Contains("both"));
 | 
			
		||||
#endif
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
    SECTION("nothrow") {
 | 
			
		||||
        SECTION("-e") {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user