Specify a maximum console width that is independent of CATCH_CONFIG_CONSOLE_WIDTH

This commit is contained in:
Nic Ramage 2021-07-26 13:14:42 +02:00
parent d4b0b34561
commit a9bbc42e9c
2 changed files with 5 additions and 1 deletions

View File

@ -18,6 +18,10 @@
#include <vector>
#include <string>
#ifndef CATCH_CONFIG_CONSOLE_MAXIMUM_WIDTH
#define CATCH_CONFIG_CONSOLE_MAXIMUM_WIDTH 512
#endif
#ifndef CATCH_CONFIG_CONSOLE_WIDTH
#define CATCH_CONFIG_CONSOLE_WIDTH 80
#endif

View File

@ -262,7 +262,7 @@ namespace Catch {
template<char C>
char const* getLineOfChars() {
static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0};
static char line[CATCH_CONFIG_CONSOLE_MAXIMUM_WIDTH] = {0};
if( !*line ) {
std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 );
line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0;