Small refactoring in AssertionResult

This commit is contained in:
Martin Hořeňovský 2023-02-19 20:23:36 +01:00
parent 1af351cea1
commit f04c93462b
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -68,16 +68,15 @@ namespace Catch {
}
std::string AssertionResult::getExpressionInMacro() const {
if ( m_info.macroName.empty() ) {
return static_cast<std::string>( m_info.capturedExpression );
}
std::string expr;
if( m_info.macroName.empty() )
expr = static_cast<std::string>(m_info.capturedExpression);
else {
expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );
expr += m_info.macroName;
expr += "( ";
expr += m_info.capturedExpression;
expr += " )";
}
return expr;
}