Clean up various minor things

This commit is contained in:
Martin Hořeňovský 2017-08-29 14:02:14 +02:00
parent 5932576f53
commit bcb430b837
7 changed files with 12 additions and 16 deletions

View File

@ -9,6 +9,9 @@
#include "catch_assertionresult.h"
namespace Catch {
AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
resultType(_resultType),
lazyExpression(_lazyExpression) {}
std::string AssertionResultData::reconstructExpression() const {

View File

@ -21,10 +21,7 @@ namespace Catch {
{
AssertionResultData() = delete;
AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression )
: resultType( _resultType ),
lazyExpression( _lazyExpression )
{}
AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );
ResultWas::OfType resultType = ResultWas::Unknown;
std::string message;

View File

@ -47,9 +47,9 @@ namespace Catch {
};
LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) {
for (int i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
if (ExceptionInfo->ExceptionRecord->ExceptionCode == signalDefs[i].id) {
reportFatal(signalDefs[i].name);
for (auto const& def : signalDefs) {
if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
reportFatal(def.name);
}
}
// If its not an exception we care about, pass it along.
@ -123,8 +123,7 @@ namespace Catch {
void FatalConditionHandler::handleSignal( int sig ) {
std::string name = "<unknown signal>";
for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
SignalDefs &def = signalDefs[i];
for (auto const& def : signalDefs) {
if (sig == def.id) {
name = def.name;
break;

View File

@ -21,14 +21,14 @@ namespace Catch {
~ReporterRegistry() override {}
IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override {
FactoryMap::const_iterator it = m_factories.find( name );
auto it = m_factories.find( name );
if( it == m_factories.end() )
return nullptr;
return it->second->create( ReporterConfig( config ) );
}
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
m_factories.insert( { name, factory } );
m_factories.emplace(name, factory);
}
void registerListener( IReporterFactoryPtr const& factory ) {
m_listeners.push_back( factory );

View File

@ -57,8 +57,7 @@ namespace Catch {
std::vector<std::string> tags;
std::string desc, tag;
bool inTag = false;
for( std::size_t i = 0; i < _descOrTags.size(); ++i ) {
char c = _descOrTags[i];
for (char c : _descOrTags) {
if( !inTag ) {
if( c == '[' )
inTag = true;

View File

@ -10,8 +10,6 @@
#include "catch_common.h"
#include <stdexcept>
namespace Catch
{

View File

@ -174,7 +174,7 @@ namespace Catch {
}
else {
SectionNode& parentNode = *m_sectionStack.back();
typename SectionNode::ChildSections::const_iterator it =
auto it =
std::find_if( parentNode.childSections.begin(),
parentNode.childSections.end(),
BySectionInfo( sectionInfo ) );