mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Use Detail::make_unique<T> in more places
This commit is contained in:
parent
3ec63324a8
commit
3579c055c8
@ -43,19 +43,13 @@ namespace Catch {
|
|||||||
return createReporter(config->getReporterName(), config);
|
return createReporter(config->getReporterName(), config);
|
||||||
}
|
}
|
||||||
|
|
||||||
// On older platforms, returning unique_ptr<ListeningReporter>
|
auto multi = Detail::make_unique<ListeningReporter>(config);
|
||||||
// when the return type is unique_ptr<IStreamingReporter>
|
|
||||||
// doesn't compile without a std::move call. However, this causes
|
|
||||||
// a warning on newer platforms. Thus, we have to work around
|
|
||||||
// it a bit and downcast the pointer manually.
|
|
||||||
auto ret = Detail::unique_ptr<IStreamingReporter>(new ListeningReporter(config));
|
|
||||||
auto& multi = static_cast<ListeningReporter&>(*ret);
|
|
||||||
auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
|
auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
|
||||||
for (auto const& listener : listeners) {
|
for (auto const& listener : listeners) {
|
||||||
multi.addListener(listener->create(Catch::ReporterConfig(config)));
|
multi->addListener(listener->create(Catch::ReporterConfig(config)));
|
||||||
}
|
}
|
||||||
multi.addReporter(createReporter(config->getReporterName(), config));
|
multi->addReporter(createReporter(config->getReporterName(), config));
|
||||||
return ret;
|
return multi;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestGroup {
|
class TestGroup {
|
||||||
|
@ -107,7 +107,7 @@ namespace Catch {
|
|||||||
makeTestCaseInfo(std::string const& _className,
|
makeTestCaseInfo(std::string const& _className,
|
||||||
NameAndTags const& nameAndTags,
|
NameAndTags const& nameAndTags,
|
||||||
SourceLineInfo const& _lineInfo ) {
|
SourceLineInfo const& _lineInfo ) {
|
||||||
return Detail::unique_ptr<TestCaseInfo>(new TestCaseInfo(_className, nameAndTags, _lineInfo));
|
return Detail::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestCaseInfo::TestCaseInfo(std::string const& _className,
|
TestCaseInfo::TestCaseInfo(std::string const& _className,
|
||||||
|
@ -145,7 +145,7 @@ namespace Detail {
|
|||||||
|
|
||||||
auto add() -> std::size_t {
|
auto add() -> std::size_t {
|
||||||
if( m_unused.empty() ) {
|
if( m_unused.empty() ) {
|
||||||
m_streams.push_back( Detail::unique_ptr<std::ostringstream>( new std::ostringstream ) );
|
m_streams.push_back( Detail::make_unique<std::ostringstream>() );
|
||||||
return m_streams.size()-1;
|
return m_streams.size()-1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user