mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-22 11:23:29 +01:00
Avoid needless copy of string in runContext::handleMessage
This commit is contained in:
parent
bd70515c08
commit
412cad546a
@ -77,7 +77,7 @@ namespace Catch {
|
||||
virtual void handleMessage
|
||||
( AssertionInfo const& info,
|
||||
ResultWas::OfType resultType,
|
||||
StringRef message,
|
||||
std::string&& message,
|
||||
AssertionReaction& reaction ) = 0;
|
||||
virtual void handleUnexpectedExceptionNotThrown
|
||||
( AssertionInfo const& info,
|
||||
|
@ -28,8 +28,8 @@ namespace Catch {
|
||||
void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
|
||||
m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
|
||||
}
|
||||
void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef message) {
|
||||
m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );
|
||||
void AssertionHandler::handleMessage(ResultWas::OfType resultType, std::string&& message) {
|
||||
m_resultCapture.handleMessage( m_assertionInfo, resultType, CATCH_MOVE(message), m_reaction );
|
||||
}
|
||||
|
||||
auto AssertionHandler::allowThrows() const -> bool {
|
||||
|
@ -47,7 +47,7 @@ namespace Catch {
|
||||
}
|
||||
void handleExpr( ITransientExpression const& expr );
|
||||
|
||||
void handleMessage(ResultWas::OfType resultType, StringRef message);
|
||||
void handleMessage(ResultWas::OfType resultType, std::string&& message);
|
||||
|
||||
void handleExceptionThrownAsExpected();
|
||||
void handleUnexpectedExceptionNotThrown();
|
||||
|
@ -632,13 +632,13 @@ namespace Catch {
|
||||
void RunContext::handleMessage(
|
||||
AssertionInfo const& info,
|
||||
ResultWas::OfType resultType,
|
||||
StringRef message,
|
||||
std::string&& message,
|
||||
AssertionReaction& reaction
|
||||
) {
|
||||
m_lastAssertionInfo = info;
|
||||
|
||||
AssertionResultData data( resultType, LazyExpression( false ) );
|
||||
data.message = static_cast<std::string>(message);
|
||||
data.message = CATCH_MOVE( message );
|
||||
AssertionResult assertionResult{ m_lastAssertionInfo,
|
||||
CATCH_MOVE( data ) };
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace Catch {
|
||||
void handleMessage
|
||||
( AssertionInfo const& info,
|
||||
ResultWas::OfType resultType,
|
||||
StringRef message,
|
||||
std::string&& message,
|
||||
AssertionReaction& reaction ) override;
|
||||
void handleUnexpectedExceptionNotThrown
|
||||
( AssertionInfo const& info,
|
||||
|
Loading…
Reference in New Issue
Block a user