diff options
author | 2017-02-05 15:45:26 +0100 | |
---|---|---|
committer | 2017-02-05 15:46:07 +0100 | |
commit | 02c97cd0f7c4d630f1a90f9f2626746e47a28c09 (patch) | |
tree | 2b48d051a55f2b65525824546cd9fcf9e05907cf /3rdparty/catch/projects/SelfTest/TestMain.cpp | |
parent | d20b4ba6864b45d0c068d98d43e63c8bc5014a3b (diff) |
Updated Catch to latest (nw)
Diffstat (limited to '3rdparty/catch/projects/SelfTest/TestMain.cpp')
-rw-r--r-- | 3rdparty/catch/projects/SelfTest/TestMain.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/3rdparty/catch/projects/SelfTest/TestMain.cpp b/3rdparty/catch/projects/SelfTest/TestMain.cpp index 16af2f67683..2a1769c3dc9 100644 --- a/3rdparty/catch/projects/SelfTest/TestMain.cpp +++ b/3rdparty/catch/projects/SelfTest/TestMain.cpp @@ -196,13 +196,13 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" } SECTION( "use-colour", "") { - + using Catch::UseColour; - + SECTION( "without option", "" ) { const char* argv[] = { "test" }; CHECK_NOTHROW( parseIntoConfig( argv, config ) ); - + REQUIRE( config.useColour == UseColour::Auto ); } @@ -216,14 +216,14 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]" SECTION( "yes", "" ) { const char* argv[] = { "test", "--use-colour", "yes" }; CHECK_NOTHROW( parseIntoConfig( argv, config ) ); - + REQUIRE( config.useColour == UseColour::Yes ); } SECTION( "no", "" ) { const char* argv[] = { "test", "--use-colour", "no" }; CHECK_NOTHROW( parseIntoConfig( argv, config ) ); - + REQUIRE( config.useColour == UseColour::No ); } @@ -299,9 +299,10 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) { CHECK( Text( testString, TextAttributes().setWidth( 10 ) ).toString() == testString ); } SECTION( "Trailing newline" , "" ) { - CHECK( Text( "abcdef\n", TextAttributes().setWidth( 10 ) ).toString() == "abcdef\n" ); + CHECK( Text( "abcdef\n", TextAttributes().setWidth( 10 ) ).toString() == "abcdef" ); CHECK( Text( "abcdef", TextAttributes().setWidth( 6 ) ).toString() == "abcdef" ); - CHECK( Text( "abcdef\n", TextAttributes().setWidth( 6 ) ).toString() == "abcdef\n" ); + CHECK( Text( "abcdef\n", TextAttributes().setWidth( 6 ) ).toString() == "abcdef" ); + CHECK( Text( "abcdef\n", TextAttributes().setWidth( 5 ) ).toString() == "abcd-\nef" ); } SECTION( "Wrapped once", "" ) { CHECK( Text( testString, TextAttributes().setWidth( 9 ) ).toString() == "one two\nthree\nfour" ); @@ -313,16 +314,23 @@ TEST_CASE( "Long strings can be wrapped", "[wrap]" ) { } } - SECTION( "With tabs", "" ) { - - // guide: 1234567890123456789 - std::string testString = "one two \tthree four five six"; + SECTION( "With wrap-before/ after characters", "" ) { + std::string testString = "one,two(three) <here>"; - CHECK( Text( testString, TextAttributes().setWidth( 15 ) ).toString() - == "one two three\n four\n five\n six" ); + SECTION( "No wrapping", "" ) { + CHECK( Text( testString, TextAttributes().setWidth( 80 ) ).toString() == testString ); + CHECK( Text( testString, TextAttributes().setWidth( 24 ) ).toString() == testString ); + } + SECTION( "Wrap before", "" ) { + CHECK( Text( testString, TextAttributes().setWidth( 11 ) ).toString() == "one,two\n(three)\n<here>" ); + } + SECTION( "Wrap after", "" ) { + CHECK( Text( testString, TextAttributes().setWidth( 6 ) ).toString() == "one,\ntwo\n(thre-\ne)\n<here>" ); + CHECK( Text( testString, TextAttributes().setWidth( 5 ) ).toString() == "one,\ntwo\n(thr-\nee)\n<her-\ne>" ); + CHECK( Text( testString, TextAttributes().setWidth( 4 ) ).toString() == "one,\ntwo\n(th-\nree)\n<he-\nre>" ); + } } - } using namespace Catch; |