Demote some single character strings into plain chars

This commit is contained in:
Martin Hořeňovský 2021-10-03 10:09:10 +02:00
parent 3e9c6fec22
commit 928e198ef2
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
11 changed files with 17 additions and 17 deletions

View File

@ -34,7 +34,7 @@ namespace Catch {
IStreamingReporterPtr createReporter(std::string const& reporterName, IConfig const* config) { IStreamingReporterPtr createReporter(std::string const& reporterName, IConfig const* config) {
auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << '\'');
return reporter; return reporter;
} }

View File

@ -113,7 +113,7 @@ namespace Catch {
} else { } else {
return ParserResult::runtimeError( return ParserResult::runtimeError(
"Expected a boolean value but did not recognise: '" + "Expected a boolean value but did not recognise: '" +
source + "'" ); source + '\'' );
} }
return ParserResult::ok( ParseResultType::Matched ); return ParserResult::ok( ParseResultType::Matched );
} }

View File

@ -221,11 +221,11 @@ namespace Catch {
auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& { auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
if (lazyExpr.m_isNegated) if (lazyExpr.m_isNegated)
os << "!"; os << '!';
if (lazyExpr) { if (lazyExpr) {
if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression()) if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
os << "(" << *lazyExpr.m_transientExpression << ")"; os << '(' << *lazyExpr.m_transientExpression << ')';
else else
os << *lazyExpr.m_transientExpression; os << *lazyExpr.m_transientExpression;
} else { } else {

View File

@ -34,14 +34,14 @@ namespace Catch {
}(); }();
if (warningSet == WarnAbout::Nothing) if (warningSet == WarnAbout::Nothing)
return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); return ParserResult::runtimeError( "Unrecognised warning: '" + warning + '\'' );
config.warnings = static_cast<WarnAbout::What>( config.warnings | warningSet ); config.warnings = static_cast<WarnAbout::What>( config.warnings | warningSet );
return ParserResult::ok( ParseResultType::Matched ); return ParserResult::ok( ParseResultType::Matched );
}; };
auto const loadTestNamesFromFile = [&]( std::string const& filename ) { auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
std::ifstream f( filename.c_str() ); std::ifstream f( filename.c_str() );
if( !f.is_open() ) if( !f.is_open() )
return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" ); return ParserResult::runtimeError( "Unable to load input file: '" + filename + '\'' );
std::string line; std::string line;
while( std::getline( f, line ) ) { while( std::getline( f, line ) ) {
@ -67,7 +67,7 @@ namespace Catch {
else if( startsWith( "random", order ) ) else if( startsWith( "random", order ) )
config.runOrder = TestRunOrder::Randomized; config.runOrder = TestRunOrder::Randomized;
else else
return ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" ); return ParserResult::runtimeError( "Unrecognised ordering: '" + order + '\'' );
return ParserResult::ok( ParseResultType::Matched ); return ParserResult::ok( ParseResultType::Matched );
}; };
auto const setRngSeed = [&]( std::string const& seed ) { auto const setRngSeed = [&]( std::string const& seed ) {
@ -112,7 +112,7 @@ namespace Catch {
else if( lcVerbosity == "high" ) else if( lcVerbosity == "high" )
config.verbosity = Verbosity::High; config.verbosity = Verbosity::High;
else else
return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" ); return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + '\'' );
return ParserResult::ok( ParseResultType::Matched ); return ParserResult::ok( ParseResultType::Matched );
}; };
auto const setReporter = [&]( std::string const& reporter ) { auto const setReporter = [&]( std::string const& reporter ) {

View File

@ -78,7 +78,7 @@ namespace Detail {
public: public:
FileStream( std::string const& filename ) { FileStream( std::string const& filename ) {
m_ofs.open( filename.c_str() ); m_ofs.open( filename.c_str() );
CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' );
} }
~FileStream() override = default; ~FileStream() override = default;
public: // IStream public: // IStream
@ -130,7 +130,7 @@ namespace Detail {
if( filename == "%debug" ) if( filename == "%debug" )
return Detail::make_unique<Detail::DebugOutStream>(); return Detail::make_unique<Detail::DebugOutStream>();
else else
CATCH_ERROR( "Unrecognised stream: '" << filename << "'" ); CATCH_ERROR( "Unrecognised stream: '" << filename << '\'' );
} }
else else
return Detail::make_unique<Detail::FileStream>( filename ); return Detail::make_unique<Detail::FileStream>( filename );

View File

@ -133,7 +133,7 @@
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */\ (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + '<' + std::string(types_list[index % num_types]) + '>', Tags } ), index++)... };/* NOLINT */\
} \ } \
}; \ }; \
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \ static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
@ -264,7 +264,7 @@
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\ constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\ constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\ constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + "<" + std::string(types_list[index % num_types]) + ">", Tags } ), index++)... };/* NOLINT */ \ (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + '<' + std::string(types_list[index % num_types]) + '>', Tags } ), index++)... };/* NOLINT */ \
}\ }\
};\ };\
static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\

View File

@ -268,7 +268,7 @@ namespace {
if (shouldIndent(fmt)) { if (shouldIndent(fmt)) {
m_os << m_indent; m_os << m_indent;
} }
m_os << "</" << m_tags.back() << ">"; m_os << "</" << m_tags.back() << '>';
} }
m_os << std::flush; m_os << std::flush;
applyFormatting(fmt); applyFormatting(fmt);

View File

@ -43,7 +43,7 @@ namespace Matchers {
description += m_operation; description += m_operation;
description += ": \""; description += ": \"";
description += m_comparator.m_str; description += m_comparator.m_str;
description += "\""; description += '"';
description += m_comparator.caseSensitivitySuffix(); description += m_comparator.caseSensitivitySuffix();
return description; return description;
} }

View File

@ -124,7 +124,7 @@ bool ExceptionMessageMatcher::match(std::exception const& ex) const {
} }
std::string ExceptionMessageMatcher::describe() const { std::string ExceptionMessageMatcher::describe() const {
return "exception message matches \"" + m_message + "\""; return "exception message matches \"" + m_message + '"';
} }
ExceptionMessageMatcher Message(std::string const& message) { ExceptionMessageMatcher Message(std::string const& message) {

View File

@ -139,7 +139,7 @@ namespace Catch {
.width( 5 + maxNameLen ) .width( 5 + maxNameLen )
<< '\n'; << '\n';
} else { } else {
out << TextFlow::Column( desc.name + ":" ) out << TextFlow::Column( desc.name + ':' )
.indent( 2 ) .indent( 2 )
.width( 5 + maxNameLen ) + .width( 5 + maxNameLen ) +
TextFlow::Column( desc.description ) TextFlow::Column( desc.description )

View File

@ -156,7 +156,7 @@ namespace Catch {
} }
if ( !m_config->name().empty() ) if ( !m_config->name().empty() )
className = m_config->name() + "." + className; className = static_cast<std::string>(m_config->name()) + '.' + className;
writeSection( className, "", rootSection ); writeSection( className, "", rootSection );
} }