diff options
| author | Phil Nash | 2015-11-04 18:01:28 +0000 |
|---|---|---|
| committer | Phil Nash | 2015-11-04 18:04:15 +0000 |
| commit | e91738103ce8dc6c0ca6c096c66b79d25f3c18d6 (patch) | |
| tree | de02bafd4199f2478d6ac9fa4c74bf9adc3934df /projects/SelfTest/TestMain.cpp | |
| parent | 8c32b49d5fd2329b20c684f21fe7098cd6da95b8 (diff) | |
| download | catch3-e91738103ce8dc6c0ca6c096c66b79d25f3c18d6.tar.gz | |
Stripped trailing whitespace from all source code lines
(replaces need for PRs #310 and #504)
Diffstat (limited to 'projects/SelfTest/TestMain.cpp')
| -rw-r--r-- | projects/SelfTest/TestMain.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/projects/SelfTest/TestMain.cpp b/projects/SelfTest/TestMain.cpp index f4c660d6..f8d17fdd 100644 --- a/projects/SelfTest/TestMain.cpp +++ b/projects/SelfTest/TestMain.cpp @@ -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" ) ); - + } |