mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-16 02:05:38 +02:00
Stripped trailing whitespace from all source code lines
(replaces need for PRs #310 and #504)
This commit is contained in:
@@ -49,13 +49,13 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
SECTION( "default - no arguments", "" ) {
|
||||
const char* argv[] = { "test" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
|
||||
CHECK( config.shouldDebugBreak == false );
|
||||
CHECK( config.abortAfter == -1 );
|
||||
CHECK( config.noThrow == false );
|
||||
CHECK( config.reporterNames.empty() );
|
||||
}
|
||||
|
||||
|
||||
SECTION( "test lists", "" ) {
|
||||
SECTION( "1 test", "Specify one test case using" ) {
|
||||
const char* argv[] = { "test", "test1" };
|
||||
@@ -84,24 +84,24 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
SECTION( "reporter", "" ) {
|
||||
SECTION( "-r/console", "" ) {
|
||||
const char* argv[] = { "test", "-r", "console" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
|
||||
REQUIRE( config.reporterNames[0] == "console" );
|
||||
}
|
||||
SECTION( "-r/xml", "" ) {
|
||||
const char* argv[] = { "test", "-r", "xml" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
|
||||
REQUIRE( config.reporterNames[0] == "xml" );
|
||||
}
|
||||
SECTION( "-r xml and junit", "" ) {
|
||||
const char* argv[] = { "test", "-r", "xml", "-r", "junit" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
|
||||
REQUIRE( config.reporterNames.size() == 2 );
|
||||
REQUIRE( config.reporterNames[0] == "xml" );
|
||||
REQUIRE( config.reporterNames[1] == "junit" );
|
||||
@@ -109,26 +109,26 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
SECTION( "--reporter/junit", "" ) {
|
||||
const char* argv[] = { "test", "--reporter", "junit" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
|
||||
REQUIRE( config.reporterNames[0] == "junit" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SECTION( "debugger", "" ) {
|
||||
SECTION( "-b", "" ) {
|
||||
const char* argv[] = { "test", "-b" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
|
||||
REQUIRE( config.shouldDebugBreak == true );
|
||||
}
|
||||
SECTION( "--break", "" ) {
|
||||
const char* argv[] = { "test", "--break" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
|
||||
REQUIRE( config.shouldDebugBreak );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SECTION( "abort", "" ) {
|
||||
SECTION( "-a aborts after first failure", "" ) {
|
||||
const char* argv[] = { "test", "-a" };
|
||||
@@ -151,7 +151,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ), Contains( "-x" ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SECTION( "nothrow", "" ) {
|
||||
SECTION( "-e", "" ) {
|
||||
const char* argv[] = { "test", "-e" };
|
||||
@@ -217,7 +217,7 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) {
|
||||
SECTION( "plain string", "" ) {
|
||||
// guide: 123456789012345678
|
||||
std::string testString = "one two three four";
|
||||
|
||||
|
||||
SECTION( "No wrapping", "" ) {
|
||||
CHECK( Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString );
|
||||
CHECK( Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString );
|
||||
@@ -261,14 +261,14 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) {
|
||||
.setInitialIndent( 1 ) );
|
||||
CHECK( text.toString() == " one two\n three\n four" );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
SECTION( "With newlines", "" ) {
|
||||
|
||||
|
||||
// guide: 1234567890123456789
|
||||
std::string testString = "one two\nthree four";
|
||||
|
||||
|
||||
SECTION( "No wrapping" , "" ) {
|
||||
CHECK( Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString );
|
||||
CHECK( Text( testString, TextAttributes().setWidth( 18 ) ).toString() == testString );
|
||||
@@ -288,17 +288,17 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) {
|
||||
CHECK( Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one\ntwo\nthree\nfour" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SECTION( "With tabs", "" ) {
|
||||
|
||||
// guide: 1234567890123456789
|
||||
std::string testString = "one two \tthree four five six";
|
||||
|
||||
|
||||
CHECK( Text( testString, TextAttributes().setWidth( 15 ) ).toString()
|
||||
== "one two three\n four\n five\n six" );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
using namespace Catch;
|
||||
@@ -324,7 +324,7 @@ public:
|
||||
ColourString( std::string const& _string, std::vector<ColourIndex> const& _colours )
|
||||
: string( _string ), colours( _colours )
|
||||
{}
|
||||
|
||||
|
||||
ColourString& addColour( Colour::Code colour, int _index ) {
|
||||
colours.push_back( ColourIndex( colour,
|
||||
resolveRelativeIndex( _index ),
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
resolveLastRelativeIndex( _toIndex ) ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
void writeToStream( std::ostream& _stream ) const {
|
||||
std::size_t last = 0;
|
||||
for( std::size_t i = 0; i < colours.size(); ++i ) {
|
||||
@@ -351,7 +351,7 @@ public:
|
||||
last = index.toIndex;
|
||||
}
|
||||
if( last < string.size() )
|
||||
_stream << string.substr( last );
|
||||
_stream << string.substr( last );
|
||||
}
|
||||
friend std::ostream& operator << ( std::ostream& _stream, ColourString const& _colourString ) {
|
||||
_colourString.writeToStream( _stream );
|
||||
@@ -408,7 +408,7 @@ TEST_CASE( "replaceInPlace", "" ) {
|
||||
|
||||
// !TBD: This will be folded into Text class
|
||||
TEST_CASE( "Strings can be rendered with colour", "[.colour]" ) {
|
||||
|
||||
|
||||
{
|
||||
ColourString cs( "hello" );
|
||||
cs .addColour( Colour::Red, 0 )
|
||||
@@ -420,19 +420,19 @@ TEST_CASE( "Strings can be rendered with colour", "[.colour]" ) {
|
||||
{
|
||||
ColourString cs( "hello" );
|
||||
cs .addColour( Colour::Blue, 1, -2 );
|
||||
|
||||
|
||||
Catch::cout() << cs << std::endl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
TEST_CASE( "Text can be formatted using the Text class", "" ) {
|
||||
|
||||
|
||||
CHECK( Text( "hi there" ).toString() == "hi there" );
|
||||
|
||||
|
||||
TextAttributes narrow;
|
||||
narrow.setWidth( 6 );
|
||||
|
||||
|
||||
CHECK( Text( "hi there", narrow ).toString() == "hi\nthere" );
|
||||
}
|
||||
|
||||
@@ -445,5 +445,5 @@ TEST_CASE( "Long text is truncted", "[Text][Truncated]" ) {
|
||||
oss << longLine << longLine << "\n";
|
||||
Text t( oss.str() );
|
||||
CHECK_THAT( t.toString(), EndsWith( "... message truncated due to excessive size" ) );
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user