Fixes overflow issue when listing tests.

This commit is contained in:
Fraser Hutchison 2013-10-24 02:01:17 +01:00
parent 54d759816f
commit 2267c950a3

View File

@ -86,12 +86,13 @@ namespace Catch {
std::cout << nameCol; std::cout << nameCol;
} }
if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) { if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) {
size_t padLen( maxNameLen > nameCol.size() ? maxNameLen - nameCol.size() : 0 );
if( i == 0 ) { if( i == 0 ) {
Colour colourGuard( Colour::SecondaryText ); Colour colourGuard( Colour::SecondaryText );
std::cout << " " << std::string( maxNameLen - nameCol.size(), '.' ) << " "; std::cout << " " << std::string( padLen, '.' ) << " ";
} }
else { else {
std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << " "; std::cout << std::string( padLen, ' ' ) << " ";
} }
std::cout << tagsWrapper[i]; std::cout << tagsWrapper[i];
} }