mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +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:
		| @@ -271,7 +271,7 @@ See [The LibIdentify repo for more information and examples](https://github.com/ | |||||||
|  |  | ||||||
| <a id="wait-for-keypress"></a> | <a id="wait-for-keypress"></a> | ||||||
| ## Wait for key before continuing | ## Wait for key before continuing | ||||||
| <pre>--wait-for-keypress <start|exit|both></pre> | <pre>--wait-for-keypress <never|start|exit|both></pre> | ||||||
|  |  | ||||||
| Will cause the executable to print a message and wait until the return/ enter key is pressed before continuing - | Will cause the executable to print a message and wait until the return/ enter key is pressed before continuing - | ||||||
| either before running any tests, after running all tests - or both, depending on the argument. | either before running any tests, after running all tests - or both, depending on the argument. | ||||||
|   | |||||||
| @@ -91,14 +91,16 @@ namespace Catch { | |||||||
|             }; |             }; | ||||||
|         auto const setWaitForKeypress = [&]( std::string const& keypress ) { |         auto const setWaitForKeypress = [&]( std::string const& keypress ) { | ||||||
|                 auto keypressLc = toLower( keypress ); |                 auto keypressLc = toLower( keypress ); | ||||||
|                 if( keypressLc == "start" ) |                 if (keypressLc == "never") | ||||||
|  |                     config.waitForKeypress = WaitForKeypress::Never; | ||||||
|  |                 else if( keypressLc == "start" ) | ||||||
|                     config.waitForKeypress = WaitForKeypress::BeforeStart; |                     config.waitForKeypress = WaitForKeypress::BeforeStart; | ||||||
|                 else if( keypressLc == "exit" ) |                 else if( keypressLc == "exit" ) | ||||||
|                     config.waitForKeypress = WaitForKeypress::BeforeExit; |                     config.waitForKeypress = WaitForKeypress::BeforeExit; | ||||||
|                 else if( keypressLc == "both" ) |                 else if( keypressLc == "both" ) | ||||||
|                     config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; |                     config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; | ||||||
|                 else |                 else | ||||||
|                     return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" ); |                     return ParserResult::runtimeError( "keypress argument must be one of: never, start, exit or both. '" + keypress + "' not recognised" ); | ||||||
|             return ParserResult::ok( ParseResultType::Matched ); |             return ParserResult::ok( ParseResultType::Matched ); | ||||||
|             }; |             }; | ||||||
|         auto const setVerbosity = [&]( std::string const& verbosity ) { |         auto const setVerbosity = [&]( std::string const& verbosity ) { | ||||||
| @@ -198,7 +200,7 @@ namespace Catch { | |||||||
|             | Opt( config.libIdentify ) |             | Opt( config.libIdentify ) | ||||||
|                 ["--libidentify"] |                 ["--libidentify"] | ||||||
|                 ( "report name and version according to libidentify standard" ) |                 ( "report name and version according to libidentify standard" ) | ||||||
|             | Opt( setWaitForKeypress, "start|exit|both" ) |             | Opt( setWaitForKeypress, "never|start|exit|both" ) | ||||||
|                 ["--wait-for-keypress"] |                 ["--wait-for-keypress"] | ||||||
|                 ( "waits for a keypress before exiting" ) |                 ( "waits for a keypress before exiting" ) | ||||||
|             | Opt( config.benchmarkSamples, "samples" ) |             | Opt( config.benchmarkSamples, "samples" ) | ||||||
|   | |||||||
| @@ -1088,6 +1088,16 @@ CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-x", "2"}) for: {?} | |||||||
| CmdLine.tests.cpp:<line number>: passed: config.abortAfter == 2 for: 2 == 2 | CmdLine.tests.cpp:<line number>: passed: config.abortAfter == 2 for: 2 == 2 | ||||||
| CmdLine.tests.cpp:<line number>: passed: !result for: true | CmdLine.tests.cpp:<line number>: passed: !result for: true | ||||||
| CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains("convert") && Contains("oops") for: "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) | CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains("convert") && Contains("oops") for: "Unable to convert 'oops' to destination type" ( contains: "convert" and contains: "oops" ) | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 0 == 0 | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 1 == 1 | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 2 == 2 | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) for: {?} | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: config.waitForKeypress == std::get<1>(input) for: 3 == 3 | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: !result for: true | ||||||
|  | CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), Contains("never") && Contains("both") for: "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) | ||||||
| CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-e"}) for: {?} | CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-e"}) for: {?} | ||||||
| CmdLine.tests.cpp:<line number>: passed: config.noThrow for: true | CmdLine.tests.cpp:<line number>: passed: config.noThrow for: true | ||||||
| CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--nothrow"}) for: {?} | CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--nothrow"}) for: {?} | ||||||
|   | |||||||
| @@ -1381,5 +1381,5 @@ due to unexpected exception with message: | |||||||
|  |  | ||||||
| =============================================================================== | =============================================================================== | ||||||
| test cases:  306 |  232 passed |  70 failed |  4 failed as expected | test cases:  306 |  232 passed |  70 failed |  4 failed as expected | ||||||
| assertions: 1666 | 1514 passed | 131 failed | 21 failed as expected | assertions: 1676 | 1524 passed | 131 failed | 21 failed as expected | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7834,6 +7834,102 @@ with expansion: | |||||||
|   "Unable to convert 'oops' to destination type" ( contains: "convert" and |   "Unable to convert 'oops' to destination type" ( contains: "convert" and | ||||||
|   contains: "oops" ) |   contains: "oops" ) | ||||||
|  |  | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | Process can be configured on command line | ||||||
|  |   abort | ||||||
|  |   wait-for-keypress | ||||||
|  |   Accepted options | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | CmdLine.tests.cpp:<line number> | ||||||
|  | ............................................................................... | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) | ||||||
|  | with expansion: | ||||||
|  |   {?} | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   REQUIRE( config.waitForKeypress == std::get<1>(input) ) | ||||||
|  | with expansion: | ||||||
|  |   0 == 0 | ||||||
|  |  | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | Process can be configured on command line | ||||||
|  |   abort | ||||||
|  |   wait-for-keypress | ||||||
|  |   Accepted options | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | CmdLine.tests.cpp:<line number> | ||||||
|  | ............................................................................... | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) | ||||||
|  | with expansion: | ||||||
|  |   {?} | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   REQUIRE( config.waitForKeypress == std::get<1>(input) ) | ||||||
|  | with expansion: | ||||||
|  |   1 == 1 | ||||||
|  |  | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | Process can be configured on command line | ||||||
|  |   abort | ||||||
|  |   wait-for-keypress | ||||||
|  |   Accepted options | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | CmdLine.tests.cpp:<line number> | ||||||
|  | ............................................................................... | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) | ||||||
|  | with expansion: | ||||||
|  |   {?} | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   REQUIRE( config.waitForKeypress == std::get<1>(input) ) | ||||||
|  | with expansion: | ||||||
|  |   2 == 2 | ||||||
|  |  | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | Process can be configured on command line | ||||||
|  |   abort | ||||||
|  |   wait-for-keypress | ||||||
|  |   Accepted options | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | CmdLine.tests.cpp:<line number> | ||||||
|  | ............................................................................... | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   CHECK( cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) ) | ||||||
|  | with expansion: | ||||||
|  |   {?} | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   REQUIRE( config.waitForKeypress == std::get<1>(input) ) | ||||||
|  | with expansion: | ||||||
|  |   3 == 3 | ||||||
|  |  | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | Process can be configured on command line | ||||||
|  |   abort | ||||||
|  |   wait-for-keypress | ||||||
|  |   invalid options are reported | ||||||
|  | ------------------------------------------------------------------------------- | ||||||
|  | CmdLine.tests.cpp:<line number> | ||||||
|  | ............................................................................... | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   CHECK( !result ) | ||||||
|  | with expansion: | ||||||
|  |   true | ||||||
|  |  | ||||||
|  | CmdLine.tests.cpp:<line number>: PASSED: | ||||||
|  |   REQUIRE_THAT( result.errorMessage(), Contains("never") && Contains("both") ) | ||||||
|  | with expansion: | ||||||
|  |   "keypress argument must be one of: never, start, exit or both. 'sometimes' | ||||||
|  |   not recognised" ( contains: "never" and contains: "both" ) | ||||||
|  |  | ||||||
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||||||
| Process can be configured on command line | Process can be configured on command line | ||||||
|   nothrow |   nothrow | ||||||
| @@ -13321,5 +13417,5 @@ Misc.tests.cpp:<line number>: PASSED: | |||||||
|  |  | ||||||
| =============================================================================== | =============================================================================== | ||||||
| test cases:  306 |  216 passed |  86 failed |  4 failed as expected | test cases:  306 |  216 passed |  86 failed |  4 failed as expected | ||||||
| assertions: 1683 | 1514 passed | 148 failed | 21 failed as expected | assertions: 1693 | 1524 passed | 148 failed | 21 failed as expected | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| <?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||||
| <testsuitesloose text artifact | <testsuitesloose text artifact | ||||||
| > | > | ||||||
|   <testsuite name="<exe-name>" errors="17" failures="132" tests="1684" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> |   <testsuite name="<exe-name>" errors="17" failures="132" tests="1694" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> | ||||||
|     <properties> |     <properties> | ||||||
|       <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/> |       <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/> | ||||||
|       <property name="random-seed" value="1"/> |       <property name="random-seed" value="1"/> | ||||||
| @@ -1004,6 +1004,8 @@ Message.tests.cpp:<line number> | |||||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-a aborts after first failure" time="{duration}"/> |     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-a aborts after first failure" time="{duration}"/> | ||||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x 2 aborts after two failures" time="{duration}"/> |     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x 2 aborts after two failures" time="{duration}"/> | ||||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x must be numeric" time="{duration}"/> |     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-x must be numeric" time="{duration}"/> | ||||||
|  |     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/wait-for-keypress/Accepted options" time="{duration}"/> | ||||||
|  |     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/wait-for-keypress/invalid options are reported" time="{duration}"/> | ||||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/-e" time="{duration}"/> |     <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/-e" time="{duration}"/> | ||||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/--nothrow" time="{duration}"/> |     <testcase classname="<exe-name>.global" name="Process can be configured on command line/nothrow/--nothrow" time="{duration}"/> | ||||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/output filename/-o filename" time="{duration}"/> |     <testcase classname="<exe-name>.global" name="Process can be configured on command line/output filename/-o filename" time="{duration}"/> | ||||||
|   | |||||||
| @@ -52,6 +52,8 @@ | |||||||
|     <testCase name="Process can be configured on command line/abort/-a aborts after first failure" duration="{duration}"/> |     <testCase name="Process can be configured on command line/abort/-a aborts after first failure" duration="{duration}"/> | ||||||
|     <testCase name="Process can be configured on command line/abort/-x 2 aborts after two failures" duration="{duration}"/> |     <testCase name="Process can be configured on command line/abort/-x 2 aborts after two failures" duration="{duration}"/> | ||||||
|     <testCase name="Process can be configured on command line/abort/-x must be numeric" duration="{duration}"/> |     <testCase name="Process can be configured on command line/abort/-x must be numeric" duration="{duration}"/> | ||||||
|  |     <testCase name="Process can be configured on command line/abort/wait-for-keypress/Accepted options" duration="{duration}"/> | ||||||
|  |     <testCase name="Process can be configured on command line/abort/wait-for-keypress/invalid options are reported" duration="{duration}"/> | ||||||
|     <testCase name="Process can be configured on command line/nothrow/-e" duration="{duration}"/> |     <testCase name="Process can be configured on command line/nothrow/-e" duration="{duration}"/> | ||||||
|     <testCase name="Process can be configured on command line/nothrow/--nothrow" duration="{duration}"/> |     <testCase name="Process can be configured on command line/nothrow/--nothrow" duration="{duration}"/> | ||||||
|     <testCase name="Process can be configured on command line/output filename/-o filename" duration="{duration}"/> |     <testCase name="Process can be configured on command line/output filename/-o filename" duration="{duration}"/> | ||||||
|   | |||||||
| @@ -9878,6 +9878,131 @@ Nor would this | |||||||
|         </Section> |         </Section> | ||||||
|         <OverallResults successes="2" failures="0" expectedFailures="0"/> |         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|       </Section> |       </Section> | ||||||
|  |       <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |         <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |           <Section name="Accepted options" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |             <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 {?} | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 config.waitForKeypress == std::get<1>(input) | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 0 == 0 | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |           </Section> | ||||||
|  |           <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |         </Section> | ||||||
|  |         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |       </Section> | ||||||
|  |       <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |         <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |           <Section name="Accepted options" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |             <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 {?} | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 config.waitForKeypress == std::get<1>(input) | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 1 == 1 | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |           </Section> | ||||||
|  |           <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |         </Section> | ||||||
|  |         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |       </Section> | ||||||
|  |       <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |         <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |           <Section name="Accepted options" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |             <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 {?} | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 config.waitForKeypress == std::get<1>(input) | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 2 == 2 | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |           </Section> | ||||||
|  |           <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |         </Section> | ||||||
|  |         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |       </Section> | ||||||
|  |       <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |         <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |           <Section name="Accepted options" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |             <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 cli.parse({"test", "--wait-for-keypress", std::get<0>(input)}) | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 {?} | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 config.waitForKeypress == std::get<1>(input) | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 3 == 3 | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |           </Section> | ||||||
|  |           <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |         </Section> | ||||||
|  |         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |       </Section> | ||||||
|  |       <Section name="abort" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |         <Section name="wait-for-keypress" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |           <Section name="invalid options are reported" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |             <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 !result | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 true | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <Expression success="true" type="REQUIRE_THAT" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|  |               <Original> | ||||||
|  |                 result.errorMessage(), Contains("never") && Contains("both") | ||||||
|  |               </Original> | ||||||
|  |               <Expanded> | ||||||
|  |                 "keypress argument must be one of: never, start, exit or both. 'sometimes' not recognised" ( contains: "never" and contains: "both" ) | ||||||
|  |               </Expanded> | ||||||
|  |             </Expression> | ||||||
|  |             <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |           </Section> | ||||||
|  |           <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |         </Section> | ||||||
|  |         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||||
|  |       </Section> | ||||||
|       <Section name="nothrow" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > |       <Section name="nothrow" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|         <Section name="-e" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > |         <Section name="-e" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
|           <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > |           <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||||
| @@ -15912,7 +16037,7 @@ loose text artifact | |||||||
|       </Section> |       </Section> | ||||||
|       <OverallResult success="true"/> |       <OverallResult success="true"/> | ||||||
|     </TestCase> |     </TestCase> | ||||||
|     <OverallResults successes="1514" failures="149" expectedFailures="21"/> |     <OverallResults successes="1524" failures="149" expectedFailures="21"/> | ||||||
|   </Group> |   </Group> | ||||||
|   <OverallResults successes="1514" failures="148" expectedFailures="21"/> |   <OverallResults successes="1524" failures="148" expectedFailures="21"/> | ||||||
| </Catch> | </Catch> | ||||||
|   | |||||||
| @@ -412,9 +412,33 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" | |||||||
|  |  | ||||||
| #ifndef CATCH_CONFIG_DISABLE_MATCHERS | #ifndef CATCH_CONFIG_DISABLE_MATCHERS | ||||||
|             REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops")); |             REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops")); | ||||||
|  | #endif | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |      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 | #endif | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |    } | ||||||
|  |  | ||||||
|     SECTION("nothrow") { |     SECTION("nothrow") { | ||||||
|         SECTION("-e") { |         SECTION("-e") { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Tristan Stenner
					Tristan Stenner