From 39ef46a02e6eac47986a907ee2f2738302105e85 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Thu, 17 Oct 2013 18:02:38 +0100 Subject: [PATCH] Truncate excessively long messages rather than asserting --- include/internal/catch_text.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/internal/catch_text.hpp b/include/internal/catch_text.hpp index 58eae6fd..f1f884dd 100644 --- a/include/internal/catch_text.hpp +++ b/include/internal/catch_text.hpp @@ -23,7 +23,10 @@ namespace Catch { std::string remainder = _str; while( !remainder.empty() ) { - assert( lines.size() < 1000 ); + if( lines.size() >= 1000 ) { + lines.push_back( "... message truncated due to excessive size" ); + return; + } std::size_t tabPos = std::string::npos; std::size_t width = (std::min)( remainder.size(), _attr.width - indent ); std::size_t pos = remainder.find_first_of( '\n' );