diff options
| author | Martin Hořeňovský | 2020-05-19 17:37:09 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-05-20 20:25:49 +0200 |
| commit | 668454b36b6be8d7f0d4d2ce8122654899052526 (patch) | |
| tree | c8785e8391633e42daa479501234b15be48c8426 /src | |
| parent | 458241cc90b71de453fb40bfeed9ccce20d45ee9 (diff) | |
| download | catch3-668454b36b6be8d7f0d4d2ce8122654899052526.tar.gz | |
Do not share ownership of Config in RunContext
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/catch_session.cpp | 6 | ||||
| -rw-r--r-- | src/catch2/internal/catch_run_context.cpp | 3 | ||||
| -rw-r--r-- | src/catch2/internal/catch_run_context.hpp | 4 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/catch2/catch_session.cpp b/src/catch2/catch_session.cpp index c3bf898b..f82c8ea0 100644 --- a/src/catch2/catch_session.cpp +++ b/src/catch2/catch_session.cpp @@ -61,7 +61,7 @@ namespace Catch { class TestGroup { public: - explicit TestGroup(IStreamingReporterPtr&& reporter, std::shared_ptr<Config> const& config): + explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config): m_reporter(reporter.get()), m_config{config}, m_context{config, std::move(reporter)} { @@ -111,7 +111,7 @@ namespace Catch { using Tests = std::set<TestCaseHandle const*>; IStreamingReporter* m_reporter; - std::shared_ptr<Config> m_config; + Config const* m_config; RunContext m_context; Tests m_tests; TestSpec::Matches m_matches; @@ -284,7 +284,7 @@ namespace Catch { return 0; } - TestGroup tests { std::move(reporter), m_config }; + TestGroup tests { std::move(reporter), m_config.get() }; auto const totals = tests.execute(); if( m_config->warnAboutNoTests() && totals.error == -1 ) diff --git a/src/catch2/internal/catch_run_context.cpp b/src/catch2/internal/catch_run_context.cpp index 379eddcc..f59a604c 100644 --- a/src/catch2/internal/catch_run_context.cpp +++ b/src/catch2/internal/catch_run_context.cpp @@ -69,7 +69,7 @@ namespace Catch { GeneratorTracker::~GeneratorTracker() {} } - RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter) + RunContext::RunContext(IConfig const* _config, IStreamingReporterPtr&& reporter) : m_runInfo(_config->name()), m_context(getCurrentMutableContext()), m_config(_config), @@ -78,7 +78,6 @@ namespace Catch { m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) { m_context.setRunner(this); - m_context.setConfig(m_config); m_context.setResultCapture(this); m_reporter->testRunStarting(m_runInfo); } diff --git a/src/catch2/internal/catch_run_context.hpp b/src/catch2/internal/catch_run_context.hpp index 622a083b..e9625717 100644 --- a/src/catch2/internal/catch_run_context.hpp +++ b/src/catch2/internal/catch_run_context.hpp @@ -36,7 +36,7 @@ namespace Catch { RunContext( RunContext const& ) = delete; RunContext& operator =( RunContext const& ) = delete; - explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter ); + explicit RunContext( IConfig const* _config, IStreamingReporterPtr&& reporter ); ~RunContext() override; @@ -131,7 +131,7 @@ namespace Catch { ITracker* m_testCaseTracker = nullptr; Option<AssertionResult> m_lastResult; - IConfigPtr m_config; + IConfig const* m_config; Totals m_totals; IStreamingReporterPtr m_reporter; std::vector<MessageInfo> m_messages; |