mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
Take std::string by const-ref where possible
Most places already do, this brings over some forgotten places. Also close #842
This commit is contained in:
parent
932a405e18
commit
e95bf48445
@ -26,7 +26,7 @@ namespace Matchers {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct StringMatcherBase : MatcherBase<std::string> {
|
struct StringMatcherBase : MatcherBase<std::string> {
|
||||||
StringMatcherBase( std::string operation, CasedString const& comparator );
|
StringMatcherBase( std::string const& operation, CasedString const& comparator );
|
||||||
virtual std::string describe() const CATCH_OVERRIDE;
|
virtual std::string describe() const CATCH_OVERRIDE;
|
||||||
|
|
||||||
CasedString m_comparator;
|
CasedString m_comparator;
|
||||||
|
@ -29,7 +29,7 @@ namespace Matchers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
StringMatcherBase::StringMatcherBase( std::string operation, CasedString const& comparator )
|
StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator )
|
||||||
: m_comparator( comparator ),
|
: m_comparator( comparator ),
|
||||||
m_operation( operation ) {
|
m_operation( operation ) {
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct TagAlias {
|
struct TagAlias {
|
||||||
TagAlias( std::string _tag, SourceLineInfo _lineInfo ) : tag( _tag ), lineInfo( _lineInfo ) {}
|
TagAlias( std::string const& _tag, SourceLineInfo _lineInfo ) : tag( _tag ), lineInfo( _lineInfo ) {}
|
||||||
|
|
||||||
std::string tag;
|
std::string tag;
|
||||||
SourceLineInfo lineInfo;
|
SourceLineInfo lineInfo;
|
||||||
|
@ -169,7 +169,7 @@ namespace Catch {
|
|||||||
stream << result.getSourceInfo() << ':';
|
stream << result.getSourceInfo() << ':';
|
||||||
}
|
}
|
||||||
|
|
||||||
void printResultType( Colour::Code colour, std::string passOrFail ) const {
|
void printResultType( Colour::Code colour, std::string const& passOrFail ) const {
|
||||||
if( !passOrFail.empty() ) {
|
if( !passOrFail.empty() ) {
|
||||||
{
|
{
|
||||||
Colour colourGuard( colour );
|
Colour colourGuard( colour );
|
||||||
@ -179,7 +179,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printIssue( std::string issue ) const {
|
void printIssue( std::string const& issue ) const {
|
||||||
stream << ' ' << issue;
|
stream << ' ' << issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,13 +157,13 @@ namespace Catch {
|
|||||||
stream << result.getSourceInfo() << ":";
|
stream << result.getSourceInfo() << ":";
|
||||||
}
|
}
|
||||||
|
|
||||||
void printResultType( std::string passOrFail ) const {
|
void printResultType( std::string const& passOrFail ) const {
|
||||||
if( !passOrFail.empty() ) {
|
if( !passOrFail.empty() ) {
|
||||||
stream << passOrFail << ' ' << counter << " -";
|
stream << passOrFail << ' ' << counter << " -";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void printIssue( std::string issue ) const {
|
void printIssue( std::string const& issue ) const {
|
||||||
stream << " " << issue;
|
stream << " " << issue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user