Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-09-09 11:30:45 +0200
committerMartin Hořeňovský2019-09-09 14:28:11 +0200
commitaf8b2538a62db34b3cec10ceb74e3d29bd06e37f (patch)
tree32069c3bf1662b5d50a78829584b3352458f238c /projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
parenta156440b19c1103419b6e4d3ebbfe3c7ddb948dc (diff)
downloadcatch3-af8b2538a62db34b3cec10ceb74e3d29bd06e37f.tar.gz
Ignore leading/trailing whitespace in test/section specs
The leading/trailing whitespace is problematic because of e.g. `WHEN` macro having preceeding whitespace for alignment, and it is generally messy. Credits to Phil who did lot of the original work. Closes #1708
Diffstat (limited to 'projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp')
-rw-r--r--projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index f4d1299a..6ecc3a14 100644
--- a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -262,7 +262,24 @@ TEST_CASE( "Parse test names and tags" ) {
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == true );
}
+ SECTION( "Leading and trailing spaces in test spec" ) {
+ TestSpec spec = parseTestSpec( "\" aardvark \"" );
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( " aardvark" ) ) );
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( "aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( "aardvark" ) ) );
+ }
+ SECTION( "Leading and trailing spaces in test name" ) {
+ TestSpec spec = parseTestSpec( "aardvark" );
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( " aardvark" ) ) );
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( "aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( "aardvark" ) ) );
+
+ }
}
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {