diff options
| author | Martin Hořeňovský | 2022-02-17 20:44:27 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-02-17 23:02:30 +0100 |
| commit | fc5552d27b57628f8faf6064ca6b305e2d3bf458 (patch) | |
| tree | e1ffae9f5e92ad3eb31ad544c06b0e1e639c4d98 /src/catch2/catch_config.cpp | |
| parent | 7cf2f88e50f0d1de324489c31db0314188423b6d (diff) | |
| download | catch3-fc5552d27b57628f8faf6064ca6b305e2d3bf458.tar.gz | |
Push down handling of default reporter to Config's constructor
This simplifies the handling of default reporter in console
parsing, at the cost of making `Config`'s constructor responsible
for more things.
Diffstat (limited to 'src/catch2/catch_config.cpp')
| -rw-r--r-- | src/catch2/catch_config.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp index c507b1b6..e6a5b2ed 100644 --- a/src/catch2/catch_config.cpp +++ b/src/catch2/catch_config.cpp @@ -6,6 +6,7 @@ // SPDX-License-Identifier: BSL-1.0 #include <catch2/catch_config.hpp> +#include <catch2/catch_user_config.hpp> #include <catch2/internal/catch_enforce.hpp> #include <catch2/internal/catch_stream.hpp> #include <catch2/internal/catch_stringref.hpp> @@ -57,6 +58,7 @@ namespace Catch { elem = trim(elem); } + TestSpecParser parser(ITagAliasRegistry::get()); if (!m_data.testsOrTags.empty()) { m_hasTestFilters = true; @@ -66,6 +68,19 @@ namespace Catch { } m_testSpec = parser.testSpec(); + + // Insert the default reporter if user hasn't asked for a specfic one + if ( m_data.reporterSpecifications.empty() ) { + m_data.reporterSpecifications.push_back( { +#if defined( CATCH_CONFIG_DEFAULT_REPORTER ) + CATCH_CONFIG_DEFAULT_REPORTER, +#else + "console", +#endif + {} + } ); + } + m_reporterStreams.reserve( m_data.reporterSpecifications.size() ); for ( auto const& reporterAndFile : m_data.reporterSpecifications ) { if ( reporterAndFile.outputFileName.none() ) { |