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
Fixes overflow issue when listing tests.
- Commit
6253386458568cbe4d097ea59309a80ee2ffa815- Author
- Fraser Hutchison ·
- Parents
93a945cee9d4
Changes
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]; }