mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-16 10:42:25 +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
|
virtual void handleMessage
|
||||||
( AssertionInfo const& info,
|
( AssertionInfo const& info,
|
||||||
ResultWas::OfType resultType,
|
ResultWas::OfType resultType,
|
||||||
StringRef message,
|
std::string&& message,
|
||||||
AssertionReaction& reaction ) = 0;
|
AssertionReaction& reaction ) = 0;
|
||||||
virtual void handleUnexpectedExceptionNotThrown
|
virtual void handleUnexpectedExceptionNotThrown
|
||||||
( AssertionInfo const& info,
|
( AssertionInfo const& info,
|
||||||
|
@ -28,8 +28,8 @@ namespace Catch {
|
|||||||
void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
|
void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
|
||||||
m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
|
m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
|
||||||
}
|
}
|
||||||
void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef message) {
|
void AssertionHandler::handleMessage(ResultWas::OfType resultType, std::string&& message) {
|
||||||
m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );
|
m_resultCapture.handleMessage( m_assertionInfo, resultType, CATCH_MOVE(message), m_reaction );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto AssertionHandler::allowThrows() const -> bool {
|
auto AssertionHandler::allowThrows() const -> bool {
|
||||||
|
@ -47,7 +47,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
void handleExpr( ITransientExpression const& expr );
|
void handleExpr( ITransientExpression const& expr );
|
||||||
|
|
||||||
void handleMessage(ResultWas::OfType resultType, StringRef message);
|
void handleMessage(ResultWas::OfType resultType, std::string&& message);
|
||||||
|
|
||||||
void handleExceptionThrownAsExpected();
|
void handleExceptionThrownAsExpected();
|
||||||
void handleUnexpectedExceptionNotThrown();
|
void handleUnexpectedExceptionNotThrown();
|
||||||
|
@ -632,13 +632,13 @@ namespace Catch {
|
|||||||
void RunContext::handleMessage(
|
void RunContext::handleMessage(
|
||||||
AssertionInfo const& info,
|
AssertionInfo const& info,
|
||||||
ResultWas::OfType resultType,
|
ResultWas::OfType resultType,
|
||||||
StringRef message,
|
std::string&& message,
|
||||||
AssertionReaction& reaction
|
AssertionReaction& reaction
|
||||||
) {
|
) {
|
||||||
m_lastAssertionInfo = info;
|
m_lastAssertionInfo = info;
|
||||||
|
|
||||||
AssertionResultData data( resultType, LazyExpression( false ) );
|
AssertionResultData data( resultType, LazyExpression( false ) );
|
||||||
data.message = static_cast<std::string>(message);
|
data.message = CATCH_MOVE( message );
|
||||||
AssertionResult assertionResult{ m_lastAssertionInfo,
|
AssertionResult assertionResult{ m_lastAssertionInfo,
|
||||||
CATCH_MOVE( data ) };
|
CATCH_MOVE( data ) };
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ namespace Catch {
|
|||||||
void handleMessage
|
void handleMessage
|
||||||
( AssertionInfo const& info,
|
( AssertionInfo const& info,
|
||||||
ResultWas::OfType resultType,
|
ResultWas::OfType resultType,
|
||||||
StringRef message,
|
std::string&& message,
|
||||||
AssertionReaction& reaction ) override;
|
AssertionReaction& reaction ) override;
|
||||||
void handleUnexpectedExceptionNotThrown
|
void handleUnexpectedExceptionNotThrown
|
||||||
( AssertionInfo const& info,
|
( AssertionInfo const& info,
|
||||||
|
Loading…
Reference in New Issue
Block a user