mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-29 16:53:30 +01:00
Demote some single character strings into plain chars
This commit is contained in:
parent
3e9c6fec22
commit
928e198ef2
@ -34,7 +34,7 @@ namespace Catch {
|
||||
|
||||
IStreamingReporterPtr createReporter(std::string const& reporterName, IConfig const* 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;
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace Catch {
|
||||
} else {
|
||||
return ParserResult::runtimeError(
|
||||
"Expected a boolean value but did not recognise: '" +
|
||||
source + "'" );
|
||||
source + '\'' );
|
||||
}
|
||||
return ParserResult::ok( ParseResultType::Matched );
|
||||
}
|
||||
|
@ -221,11 +221,11 @@ namespace Catch {
|
||||
|
||||
auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
|
||||
if (lazyExpr.m_isNegated)
|
||||
os << "!";
|
||||
os << '!';
|
||||
|
||||
if (lazyExpr) {
|
||||
if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
|
||||
os << "(" << *lazyExpr.m_transientExpression << ")";
|
||||
os << '(' << *lazyExpr.m_transientExpression << ')';
|
||||
else
|
||||
os << *lazyExpr.m_transientExpression;
|
||||
} else {
|
||||
|
@ -34,14 +34,14 @@ namespace Catch {
|
||||
}();
|
||||
|
||||
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 );
|
||||
return ParserResult::ok( ParseResultType::Matched );
|
||||
};
|
||||
auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
|
||||
std::ifstream f( filename.c_str() );
|
||||
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;
|
||||
while( std::getline( f, line ) ) {
|
||||
@ -67,7 +67,7 @@ namespace Catch {
|
||||
else if( startsWith( "random", order ) )
|
||||
config.runOrder = TestRunOrder::Randomized;
|
||||
else
|
||||
return ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" );
|
||||
return ParserResult::runtimeError( "Unrecognised ordering: '" + order + '\'' );
|
||||
return ParserResult::ok( ParseResultType::Matched );
|
||||
};
|
||||
auto const setRngSeed = [&]( std::string const& seed ) {
|
||||
@ -112,7 +112,7 @@ namespace Catch {
|
||||
else if( lcVerbosity == "high" )
|
||||
config.verbosity = Verbosity::High;
|
||||
else
|
||||
return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" );
|
||||
return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + '\'' );
|
||||
return ParserResult::ok( ParseResultType::Matched );
|
||||
};
|
||||
auto const setReporter = [&]( std::string const& reporter ) {
|
||||
|
@ -78,7 +78,7 @@ namespace Detail {
|
||||
public:
|
||||
FileStream( std::string const& filename ) {
|
||||
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;
|
||||
public: // IStream
|
||||
@ -130,7 +130,7 @@ namespace Detail {
|
||||
if( filename == "%debug" )
|
||||
return Detail::make_unique<Detail::DebugOutStream>();
|
||||
else
|
||||
CATCH_ERROR( "Unrecognised stream: '" << filename << "'" );
|
||||
CATCH_ERROR( "Unrecognised stream: '" << filename << '\'' );
|
||||
}
|
||||
else
|
||||
return Detail::make_unique<Detail::FileStream>( filename );
|
||||
|
@ -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* 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]);\
|
||||
(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 ) = [](){ \
|
||||
@ -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* 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]);\
|
||||
(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 ) = [](){\
|
||||
|
@ -268,7 +268,7 @@ namespace {
|
||||
if (shouldIndent(fmt)) {
|
||||
m_os << m_indent;
|
||||
}
|
||||
m_os << "</" << m_tags.back() << ">";
|
||||
m_os << "</" << m_tags.back() << '>';
|
||||
}
|
||||
m_os << std::flush;
|
||||
applyFormatting(fmt);
|
||||
|
@ -43,7 +43,7 @@ namespace Matchers {
|
||||
description += m_operation;
|
||||
description += ": \"";
|
||||
description += m_comparator.m_str;
|
||||
description += "\"";
|
||||
description += '"';
|
||||
description += m_comparator.caseSensitivitySuffix();
|
||||
return description;
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ bool ExceptionMessageMatcher::match(std::exception const& ex) const {
|
||||
}
|
||||
|
||||
std::string ExceptionMessageMatcher::describe() const {
|
||||
return "exception message matches \"" + m_message + "\"";
|
||||
return "exception message matches \"" + m_message + '"';
|
||||
}
|
||||
|
||||
ExceptionMessageMatcher Message(std::string const& message) {
|
||||
|
@ -139,7 +139,7 @@ namespace Catch {
|
||||
.width( 5 + maxNameLen )
|
||||
<< '\n';
|
||||
} else {
|
||||
out << TextFlow::Column( desc.name + ":" )
|
||||
out << TextFlow::Column( desc.name + ':' )
|
||||
.indent( 2 )
|
||||
.width( 5 + maxNameLen ) +
|
||||
TextFlow::Column( desc.description )
|
||||
|
@ -156,7 +156,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
if ( !m_config->name().empty() )
|
||||
className = m_config->name() + "." + className;
|
||||
className = static_cast<std::string>(m_config->name()) + '.' + className;
|
||||
|
||||
writeSection( className, "", rootSection );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user