Split long failure expressions over multiple lines at the operator

This commit is contained in:
Phil Nash 2012-05-07 19:12:43 +01:00
parent e848a91704
commit a201f715a8

View File

@ -168,7 +168,14 @@ namespace Catch
else if( m_op == "matches" ) else if( m_op == "matches" )
return m_lhs + " " + m_rhs; return m_lhs + " " + m_rhs;
else if( m_op != "!" ) else if( m_op != "!" )
return m_lhs + " " + m_op + " " + m_rhs; {
if( m_lhs.size() + m_rhs.size() < 30 )
return m_lhs + " " + m_op + " " + m_rhs;
else if( m_lhs.size() < 70 && m_rhs.size() < 70 )
return "\n\t" + m_lhs + "\n\t" + m_op + "\n\t" + m_rhs;
else
return "\n" + m_lhs + "\n" + m_op + "\n" + m_rhs + "\n\n";
}
else else
return "{can't expand - use " + m_macroName + "_FALSE( " + m_expr.substr(1) + " ) instead of " + m_macroName + "( " + m_expr + " ) for better diagnostics}"; return "{can't expand - use " + m_macroName + "_FALSE( " + m_expr.substr(1) + " ) instead of " + m_macroName + "( " + m_expr + " ) for better diagnostics}";
} }