mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Allow only 1 reporter at a time
This commit is contained in:
		| @@ -130,7 +130,7 @@ namespace Catch { | ||||
|             | Opt( config.outputFilename, "filename" ) | ||||
|                 ["-o"]["--out"] | ||||
|                 ( "output filename" ) | ||||
|             | Opt( config.reporterNames, "name" ) | ||||
|             | Opt( config.reporterName, "name" ) | ||||
|                 ["-r"]["--reporter"] | ||||
|                 ( "reporter to use (defaults to console)" ) | ||||
|             | Opt( config.name, "name" ) | ||||
|   | ||||
| @@ -37,8 +37,8 @@ namespace Catch { | ||||
|     bool Config::listReporters() const      { return m_data.listReporters; } | ||||
|  | ||||
|     std::string Config::getProcessName() const { return m_data.processName; } | ||||
|     std::string const& Config::getReporterName() const { return m_data.reporterName; } | ||||
|  | ||||
|     std::vector<std::string> const& Config::getReporterNames() const { return m_data.reporterNames; } | ||||
|     std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; } | ||||
|     std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } | ||||
|  | ||||
|   | ||||
| @@ -55,7 +55,13 @@ namespace Catch { | ||||
|         std::string name; | ||||
|         std::string processName; | ||||
|  | ||||
|         std::vector<std::string> reporterNames; | ||||
| #ifndef CATCH_CONFIG_DEFAULT_REPORTER | ||||
| #define CATCH_CONFIG_DEFAULT_REPORTER "console" | ||||
| #endif | ||||
|         std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER; | ||||
| #undef CATCH_CONFIG_DEFAULT_REPORTER | ||||
|  | ||||
|  | ||||
|         std::vector<std::string> testsOrTags; | ||||
|         std::vector<std::string> sectionsToRun; | ||||
|     }; | ||||
| @@ -76,8 +82,8 @@ namespace Catch { | ||||
|         bool listReporters() const; | ||||
|  | ||||
|         std::string getProcessName() const; | ||||
|         std::string const& getReporterName() const; | ||||
|  | ||||
|         std::vector<std::string> const& getReporterNames() const; | ||||
|         std::vector<std::string> const& getTestsOrTags() const; | ||||
|         std::vector<std::string> const& getSectionsToRun() const override; | ||||
|  | ||||
|   | ||||
| @@ -36,22 +36,11 @@ namespace Catch { | ||||
|             return reporter; | ||||
|         } | ||||
|  | ||||
| #ifndef CATCH_CONFIG_DEFAULT_REPORTER | ||||
| #define CATCH_CONFIG_DEFAULT_REPORTER "console" | ||||
| #endif | ||||
|  | ||||
|         IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) { | ||||
|             auto const& reporterNames = config->getReporterNames(); | ||||
|             if (reporterNames.empty()) | ||||
|                 return createReporter(CATCH_CONFIG_DEFAULT_REPORTER, config); | ||||
|  | ||||
|             IStreamingReporterPtr reporter; | ||||
|             for (auto const& name : reporterNames) | ||||
|                 addReporter(reporter, createReporter(name, config)); | ||||
|             return reporter; | ||||
|             return createReporter(config->getReporterName(), config); | ||||
|         } | ||||
|  | ||||
| #undef CATCH_CONFIG_DEFAULT_REPORTER | ||||
|  | ||||
|         void addListeners(IStreamingReporterPtr& reporters, IConfigPtr const& config) { | ||||
|             auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský