summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/catch/projects/SelfTest/TestMain.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/catch/projects/SelfTest/TestMain.cpp')
-rw-r--r--3rdparty/catch/projects/SelfTest/TestMain.cpp36
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;