Allows console line width to be configured (and defaults to 80).

Line wrap is at console width-1
This commit is contained in:
Phil Nash 2013-01-26 20:06:55 +00:00
parent 3682433c2f
commit 67ccd8d74a
3 changed files with 338 additions and 337 deletions

View File

@ -18,6 +18,10 @@
#include <string> #include <string>
#include <iostream> #include <iostream>
#ifndef CATCH_CONFIG_CONSOLE_WIDTH
#define CATCH_CONFIG_CONSOLE_WIDTH 80
#endif
namespace Catch { namespace Catch {
struct Include { enum WhichResults { struct Include { enum WhichResults {

View File

@ -199,7 +199,7 @@ namespace Catch {
} }
static std::string wrapLongStrings( std::string const& _string ){ static std::string wrapLongStrings( std::string const& _string ){
return Catch::wrapLongStrings( _string, 70, 2 ); return Catch::wrapLongStrings( _string, CATCH_CONFIG_CONSOLE_WIDTH-1, 2 );
} }
std::ostream& stream; std::ostream& stream;
@ -330,18 +330,15 @@ namespace Catch {
stream << getDashes() << "\n"; stream << getDashes() << "\n";
} }
static std::string const& getDashes() { static std::string const& getDashes() {
static const std::string dashes static const std::string dashes( CATCH_CONFIG_CONSOLE_WIDTH-1, '-' );
= "-----------------------------------------------------------------";
return dashes; return dashes;
} }
static std::string const& getDots() { static std::string const& getDots() {
static const std::string dots static const std::string dots( CATCH_CONFIG_CONSOLE_WIDTH-1, '.' );
= ".................................................................";
return dots; return dots;
} }
static std::string const& getDoubleDashes() { static std::string const& getDoubleDashes() {
static const std::string doubleDashes static const std::string doubleDashes( CATCH_CONFIG_CONSOLE_WIDTH-1, '=' );
= "=================================================================";
return doubleDashes; return doubleDashes;
} }

File diff suppressed because it is too large Load Diff