Truncate excessively long messages rather than asserting

This commit is contained in:
Phil Nash 2013-10-17 18:02:38 +01:00
parent aafed303bb
commit 39ef46a02e

View File

@ -23,7 +23,10 @@ namespace Catch {
std::string remainder = _str; std::string remainder = _str;
while( !remainder.empty() ) { 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 tabPos = std::string::npos;
std::size_t width = (std::min)( remainder.size(), _attr.width - indent ); std::size_t width = (std::min)( remainder.size(), _attr.width - indent );
std::size_t pos = remainder.find_first_of( '\n' ); std::size_t pos = remainder.find_first_of( '\n' );