Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Split long failure expressions over multiple lines at the operator

Commit
a201f715a84c3f936e2442e40b4c7f3072d41326
Author
Phil Nash ·
Parents
e848a9170482

Files · Download .tar.gz

Changes

 include/internal/catch_resultinfo.hpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/include/internal/catch_resultinfo.hpp b/include/internal/catch_resultinfo.hpp
index 9119bd44..d6005268 100644
--- a/include/internal/catch_resultinfo.hpp
+++ b/include/internal/catch_resultinfo.hpp
@@ -168,7 +168,14 @@ namespace Catch
             else if( m_op == "matches" )
                 return m_lhs + " " + m_rhs;
             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
                 return "{can't expand - use " + m_macroName + "_FALSE( " + m_expr.substr(1) + " ) instead of " + m_macroName + "( " + m_expr + " ) for better diagnostics}";
         }