From 6253386458568cbe4d097ea59309a80ee2ffa815 Mon Sep 17 00:00:00 2001 From: Fraser Hutchison Date: Thu, 24 Oct 2013 02:53:13 +0100 Subject: [PATCH] Fixes overflow issue when listing tests. --- include/internal/catch_list.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp index 550107f8..45807edd 100644 --- a/include/internal/catch_list.hpp +++ b/include/internal/catch_list.hpp @@ -86,12 +86,13 @@ namespace Catch { std::cout << nameCol; } if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) { + size_t padLen( maxNameLen > nameCol.size() ? maxNameLen - nameCol.size() : 0 ); if( i == 0 ) { Colour colourGuard( Colour::SecondaryText ); - std::cout << " " << std::string( maxNameLen - nameCol.size(), '.' ) << " "; + std::cout << " " << std::string( padLen, '.' ) << " "; } else { - std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << " "; + std::cout << std::string( padLen, ' ' ) << " "; } std::cout << tagsWrapper[i]; }