mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Do not share ownership of Config in RunContext
This commit is contained in:
parent
458241cc90
commit
668454b36b
@ -61,7 +61,7 @@ namespace Catch {
|
|||||||
|
|
||||||
class TestGroup {
|
class TestGroup {
|
||||||
public:
|
public:
|
||||||
explicit TestGroup(IStreamingReporterPtr&& reporter, std::shared_ptr<Config> const& config):
|
explicit TestGroup(IStreamingReporterPtr&& reporter, Config const* config):
|
||||||
m_reporter(reporter.get()),
|
m_reporter(reporter.get()),
|
||||||
m_config{config},
|
m_config{config},
|
||||||
m_context{config, std::move(reporter)} {
|
m_context{config, std::move(reporter)} {
|
||||||
@ -111,7 +111,7 @@ namespace Catch {
|
|||||||
using Tests = std::set<TestCaseHandle const*>;
|
using Tests = std::set<TestCaseHandle const*>;
|
||||||
|
|
||||||
IStreamingReporter* m_reporter;
|
IStreamingReporter* m_reporter;
|
||||||
std::shared_ptr<Config> m_config;
|
Config const* m_config;
|
||||||
RunContext m_context;
|
RunContext m_context;
|
||||||
Tests m_tests;
|
Tests m_tests;
|
||||||
TestSpec::Matches m_matches;
|
TestSpec::Matches m_matches;
|
||||||
@ -284,7 +284,7 @@ namespace Catch {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TestGroup tests { std::move(reporter), m_config };
|
TestGroup tests { std::move(reporter), m_config.get() };
|
||||||
auto const totals = tests.execute();
|
auto const totals = tests.execute();
|
||||||
|
|
||||||
if( m_config->warnAboutNoTests() && totals.error == -1 )
|
if( m_config->warnAboutNoTests() && totals.error == -1 )
|
||||||
|
@ -69,7 +69,7 @@ namespace Catch {
|
|||||||
GeneratorTracker::~GeneratorTracker() {}
|
GeneratorTracker::~GeneratorTracker() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter)
|
RunContext::RunContext(IConfig const* _config, IStreamingReporterPtr&& reporter)
|
||||||
: m_runInfo(_config->name()),
|
: m_runInfo(_config->name()),
|
||||||
m_context(getCurrentMutableContext()),
|
m_context(getCurrentMutableContext()),
|
||||||
m_config(_config),
|
m_config(_config),
|
||||||
@ -78,7 +78,6 @@ namespace Catch {
|
|||||||
m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions )
|
m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions )
|
||||||
{
|
{
|
||||||
m_context.setRunner(this);
|
m_context.setRunner(this);
|
||||||
m_context.setConfig(m_config);
|
|
||||||
m_context.setResultCapture(this);
|
m_context.setResultCapture(this);
|
||||||
m_reporter->testRunStarting(m_runInfo);
|
m_reporter->testRunStarting(m_runInfo);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ namespace Catch {
|
|||||||
RunContext( RunContext const& ) = delete;
|
RunContext( RunContext const& ) = delete;
|
||||||
RunContext& operator =( RunContext const& ) = delete;
|
RunContext& operator =( RunContext const& ) = delete;
|
||||||
|
|
||||||
explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter );
|
explicit RunContext( IConfig const* _config, IStreamingReporterPtr&& reporter );
|
||||||
|
|
||||||
~RunContext() override;
|
~RunContext() override;
|
||||||
|
|
||||||
@ -131,7 +131,7 @@ namespace Catch {
|
|||||||
ITracker* m_testCaseTracker = nullptr;
|
ITracker* m_testCaseTracker = nullptr;
|
||||||
Option<AssertionResult> m_lastResult;
|
Option<AssertionResult> m_lastResult;
|
||||||
|
|
||||||
IConfigPtr m_config;
|
IConfig const* m_config;
|
||||||
Totals m_totals;
|
Totals m_totals;
|
||||||
IStreamingReporterPtr m_reporter;
|
IStreamingReporterPtr m_reporter;
|
||||||
std::vector<MessageInfo> m_messages;
|
std::vector<MessageInfo> m_messages;
|
||||||
|
Loading…
Reference in New Issue
Block a user