mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 05:15:39 +02:00
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.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <catch2/matchers/catch_matchers_string.hpp>
|
||||
#include <catch2/internal/catch_test_spec_parser.hpp>
|
||||
#include <catch2/catch_user_config.hpp>
|
||||
#include <catch2/catch_test_case_info.hpp>
|
||||
#include <catch2/internal/catch_commandline.hpp>
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
@@ -348,10 +349,23 @@ 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.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} });
|
||||
CHECK( config.reporterSpecifications.empty() );
|
||||
|
||||
Catch::Config cfg(config);
|
||||
CHECK_FALSE(cfg.hasTestFilters());
|
||||
|
||||
// The Config is responsible for mixing in the default reporter
|
||||
auto expectedReporter =
|
||||
#if defined( CATCH_CONFIG_DEFAULT_REPORTER )
|
||||
CATCH_CONFIG_DEFAULT_REPORTER
|
||||
#else
|
||||
"console"
|
||||
#endif
|
||||
;
|
||||
|
||||
CHECK( cfg.getReportersAndOutputFiles().size() == 1 );
|
||||
CHECK( cfg.getReportersAndOutputFiles()[0] ==
|
||||
Catch::ConfigData::ReporterAndFile{ expectedReporter, {} } );
|
||||
}
|
||||
|
||||
SECTION("test lists") {
|
||||
|
Reference in New Issue
Block a user