mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Allow only 1 reporter at a time
This commit is contained in:
		| @@ -528,7 +528,7 @@ CmdLine.tests.cpp:<line number>: passed: config.processName == "test" for: "test | ||||
| CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak == false for: false == false | ||||
| CmdLine.tests.cpp:<line number>: passed: config.abortAfter == -1 for: -1 == -1 | ||||
| CmdLine.tests.cpp:<line number>: passed: config.noThrow == false for: false == false | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterNames.empty() for: true | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterName == "console" for: "console" == "console" | ||||
| CmdLine.tests.cpp:<line number>: passed: !(cfg.hasTestFilters()) for: !false | ||||
| CmdLine.tests.cpp:<line number>: passed: result for: {?} | ||||
| CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true | ||||
| @@ -543,15 +543,12 @@ CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true | ||||
| CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("test1")) == false for: false == false | ||||
| CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(fakeTestCase("alwaysIncluded")) for: true | ||||
| CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "console"}) for: {?} | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "console" for: "console" == "console" | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterName == "console" for: "console" == "console" | ||||
| CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "xml"}) for: {?} | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "xml" for: "xml" == "xml" | ||||
| CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-r", "xml", "-r", "junit"}) for: {?} | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterNames.size() == 2 for: 2 == 2 | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "xml" for: "xml" == "xml" | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterNames[1] == "junit" for: "junit" == "junit" | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterName == "xml" for: "xml" == "xml" | ||||
| CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--reporter", "junit"}) for: {?} | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterNames[0] == "junit" for: "junit" == "junit" | ||||
| CmdLine.tests.cpp:<line number>: passed: config.reporterName == "junit" for: "junit" == "junit" | ||||
| CmdLine.tests.cpp:<line number>: passed: !(cli.parse({ "test", "-r", "xml", "-r", "junit" })) for: !{?} | ||||
| CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "-b"}) for: {?} | ||||
| CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak == true for: true == true | ||||
| CmdLine.tests.cpp:<line number>: passed: cli.parse({"test", "--break"}) for: {?} | ||||
|   | ||||
| @@ -1085,5 +1085,5 @@ due to unexpected exception with message: | ||||
|  | ||||
| =============================================================================== | ||||
| test cases:  205 | 152 passed |  49 failed |  4 failed as expected | ||||
| assertions: 1063 | 935 passed | 107 failed | 21 failed as expected | ||||
| assertions: 1060 | 932 passed | 107 failed | 21 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -4080,9 +4080,9 @@ with expansion: | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   CHECK( config.reporterNames.empty() ) | ||||
|   CHECK( config.reporterName == "console" ) | ||||
| with expansion: | ||||
|   true | ||||
|   "console" == "console" | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
| @@ -4202,7 +4202,7 @@ with expansion: | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( config.reporterNames[0] == "console" ) | ||||
|   REQUIRE( config.reporterName == "console" ) | ||||
| with expansion: | ||||
|   "console" == "console" | ||||
|  | ||||
| @@ -4222,42 +4222,10 @@ with expansion: | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( config.reporterNames[0] == "xml" ) | ||||
|   REQUIRE( config.reporterName == "xml" ) | ||||
| with expansion: | ||||
|   "xml" == "xml" | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Process can be configured on command line | ||||
|   reporter | ||||
|   -r xml and junit | ||||
| ------------------------------------------------------------------------------- | ||||
| CmdLine.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   CHECK( cli.parse({"test", "-r", "xml", "-r", "junit"}) ) | ||||
| with expansion: | ||||
|   {?} | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( config.reporterNames.size() == 2 ) | ||||
| with expansion: | ||||
|   2 == 2 | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( config.reporterNames[0] == "xml" ) | ||||
| with expansion: | ||||
|   "xml" == "xml" | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( config.reporterNames[1] == "junit" ) | ||||
| with expansion: | ||||
|   "junit" == "junit" | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Process can be configured on command line | ||||
|   reporter | ||||
| @@ -4274,10 +4242,24 @@ with expansion: | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE( config.reporterNames[0] == "junit" ) | ||||
|   REQUIRE( config.reporterName == "junit" ) | ||||
| with expansion: | ||||
|   "junit" == "junit" | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Process can be configured on command line | ||||
|   reporter | ||||
|   Only one reporter is accepted | ||||
| ------------------------------------------------------------------------------- | ||||
| CmdLine.tests.cpp:<line number> | ||||
| ............................................................................... | ||||
|  | ||||
| CmdLine.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE_FALSE( cli.parse({ "test", "-r", "xml", "-r", "junit" }) ) | ||||
| with expansion: | ||||
|   !{?} | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Process can be configured on command line | ||||
|   debugger | ||||
| @@ -8960,5 +8942,5 @@ PASSED: | ||||
|  | ||||
| =============================================================================== | ||||
| test cases:  205 | 139 passed |  62 failed |  4 failed as expected | ||||
| assertions: 1077 | 935 passed | 121 failed | 21 failed as expected | ||||
| assertions: 1074 | 932 passed | 121 failed | 21 failed as expected | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <testsuitesloose text artifact | ||||
| > | ||||
|   <testsuite name="<exe-name>" errors="17" failures="105" tests="1078" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> | ||||
|   <testsuite name="<exe-name>" errors="17" failures="105" tests="1075" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> | ||||
|     <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="#1027" time="{duration}"/> | ||||
| @@ -474,8 +474,8 @@ Message.tests.cpp:<line number> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/test lists/Specify one test case exclusion using ~" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/console" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r/xml" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/-r xml and junit" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/--reporter/junit" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/reporter/Only one reporter is accepted" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/debugger/-b" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/debugger/--break" time="{duration}"/> | ||||
|     <testcase classname="<exe-name>.global" name="Process can be configured on command line/abort/-a aborts after first failure" time="{duration}"/> | ||||
|   | ||||
| @@ -4757,10 +4757,10 @@ | ||||
|         </Expression> | ||||
|         <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|           <Original> | ||||
|             config.reporterNames.empty() | ||||
|             config.reporterName == "console" | ||||
|           </Original> | ||||
|           <Expanded> | ||||
|             true | ||||
|             "console" == "console" | ||||
|           </Expanded> | ||||
|         </Expression> | ||||
|         <Expression success="true" type="CHECK_FALSE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
| @@ -4899,7 +4899,7 @@ | ||||
|           </Expression> | ||||
|           <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|             <Original> | ||||
|               config.reporterNames[0] == "console" | ||||
|               config.reporterName == "console" | ||||
|             </Original> | ||||
|             <Expanded> | ||||
|               "console" == "console" | ||||
| @@ -4921,7 +4921,7 @@ | ||||
|           </Expression> | ||||
|           <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|             <Original> | ||||
|               config.reporterNames[0] == "xml" | ||||
|               config.reporterName == "xml" | ||||
|             </Original> | ||||
|             <Expanded> | ||||
|               "xml" == "xml" | ||||
| @@ -4931,44 +4931,6 @@ | ||||
|         </Section> | ||||
|         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||
|       </Section> | ||||
|       <Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|         <Section name="-r xml and junit" 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", "-r", "xml", "-r", "junit"}) | ||||
|             </Original> | ||||
|             <Expanded> | ||||
|               {?} | ||||
|             </Expanded> | ||||
|           </Expression> | ||||
|           <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|             <Original> | ||||
|               config.reporterNames.size() == 2 | ||||
|             </Original> | ||||
|             <Expanded> | ||||
|               2 == 2 | ||||
|             </Expanded> | ||||
|           </Expression> | ||||
|           <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|             <Original> | ||||
|               config.reporterNames[0] == "xml" | ||||
|             </Original> | ||||
|             <Expanded> | ||||
|               "xml" == "xml" | ||||
|             </Expanded> | ||||
|           </Expression> | ||||
|           <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|             <Original> | ||||
|               config.reporterNames[1] == "junit" | ||||
|             </Original> | ||||
|             <Expanded> | ||||
|               "junit" == "junit" | ||||
|             </Expanded> | ||||
|           </Expression> | ||||
|           <OverallResults successes="4" failures="0" expectedFailures="0"/> | ||||
|         </Section> | ||||
|         <OverallResults successes="4" failures="0" expectedFailures="0"/> | ||||
|       </Section> | ||||
|       <Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|         <Section name="--reporter/junit" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|           <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
| @@ -4981,7 +4943,7 @@ | ||||
|           </Expression> | ||||
|           <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|             <Original> | ||||
|               config.reporterNames[0] == "junit" | ||||
|               config.reporterName == "junit" | ||||
|             </Original> | ||||
|             <Expanded> | ||||
|               "junit" == "junit" | ||||
| @@ -4991,6 +4953,20 @@ | ||||
|         </Section> | ||||
|         <OverallResults successes="2" failures="0" expectedFailures="0"/> | ||||
|       </Section> | ||||
|       <Section name="reporter" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|         <Section name="Only one reporter is accepted" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|           <Expression success="true" type="REQUIRE_FALSE" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|             <Original> | ||||
|               !(cli.parse({ "test", "-r", "xml", "-r", "junit" })) | ||||
|             </Original> | ||||
|             <Expanded> | ||||
|               !{?} | ||||
|             </Expanded> | ||||
|           </Expression> | ||||
|           <OverallResults successes="1" failures="0" expectedFailures="0"/> | ||||
|         </Section> | ||||
|         <OverallResults successes="1" failures="0" expectedFailures="0"/> | ||||
|       </Section> | ||||
|       <Section name="debugger" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|         <Section name="-b" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
|           <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > | ||||
| @@ -9913,7 +9889,7 @@ loose text artifact | ||||
|       </Section> | ||||
|       <OverallResult success="true"/> | ||||
|     </TestCase> | ||||
|     <OverallResults successes="935" failures="122" expectedFailures="21"/> | ||||
|     <OverallResults successes="932" failures="122" expectedFailures="21"/> | ||||
|   </Group> | ||||
|   <OverallResults successes="935" failures="121" expectedFailures="21"/> | ||||
|   <OverallResults successes="932" failures="121" expectedFailures="21"/> | ||||
| </Catch> | ||||
|   | ||||
| @@ -288,7 +288,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" | ||||
|         CHECK(config.shouldDebugBreak == false); | ||||
|         CHECK(config.abortAfter == -1); | ||||
|         CHECK(config.noThrow == false); | ||||
|         CHECK(config.reporterNames.empty()); | ||||
|         CHECK(config.reporterName == "console"); | ||||
|  | ||||
|         Catch::Config cfg(config); | ||||
|         CHECK_FALSE(cfg.hasTestFilters()); | ||||
| @@ -330,24 +330,20 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" | ||||
|         SECTION("-r/console") { | ||||
|             CHECK(cli.parse({"test", "-r", "console"})); | ||||
|  | ||||
|             REQUIRE(config.reporterNames[0] == "console"); | ||||
|             REQUIRE(config.reporterName == "console"); | ||||
|         } | ||||
|         SECTION("-r/xml") { | ||||
|             CHECK(cli.parse({"test", "-r", "xml"})); | ||||
|  | ||||
|             REQUIRE(config.reporterNames[0] == "xml"); | ||||
|         } | ||||
|         SECTION("-r xml and junit") { | ||||
|             CHECK(cli.parse({"test", "-r", "xml", "-r", "junit"})); | ||||
|  | ||||
|             REQUIRE(config.reporterNames.size() == 2); | ||||
|             REQUIRE(config.reporterNames[0] == "xml"); | ||||
|             REQUIRE(config.reporterNames[1] == "junit"); | ||||
|             REQUIRE(config.reporterName == "xml"); | ||||
|         } | ||||
|         SECTION("--reporter/junit") { | ||||
|             CHECK(cli.parse({"test", "--reporter", "junit"})); | ||||
|  | ||||
|             REQUIRE(config.reporterNames[0] == "junit"); | ||||
|             REQUIRE(config.reporterName == "junit"); | ||||
|         } | ||||
|         SECTION("Only one reporter is accepted") { | ||||
|             REQUIRE_FALSE(cli.parse({ "test", "-r", "xml", "-r", "junit" })); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský