Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

-f supports quoted test names (test name surrounded with " characters).

This is the first part to resolving #717
Commit
b1eeec7c6976ac23b3d28986eff93d605a7f12e7
Author
Phil Nash ·
Parents
c23b374f3dea

Files · Download .tar.gz

Changes

 include/internal/catch_commandline.hpp | 7 +++++--
 projects/SelfTest/MiscTests.cpp        | 4 ++++
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/internal/catch_commandline.hpp b/include/internal/catch_commandline.hpp
index 6926559a..89eced34 100644
--- a/include/internal/catch_commandline.hpp
+++ b/include/internal/catch_commandline.hpp
@@ -85,8 +85,11 @@ namespace Catch {
         std::string line;
         while( std::getline( f, line ) ) {
             line = trim(line);
-            if( !line.empty() && !startsWith( line, "#" ) )
-                addTestOrTags( config, "\"" + line + "\"," );
+            if( !line.empty() && !startsWith( line, "#" ) ) {
+                if( !startsWith( line, "\"" ) )
+                    line = "\"" + line + "\"";
+                addTestOrTags( config, line + "," );
+            }
         }
     }
 
diff --git a/projects/SelfTest/MiscTests.cpp b/projects/SelfTest/MiscTests.cpp
index bb9cbf0a..b440b412 100644
--- a/projects/SelfTest/MiscTests.cpp
+++ b/projects/SelfTest/MiscTests.cpp
@@ -483,3 +483,7 @@ TEST_CASE( "This test 'should' fail but doesn't", "[.][failing][!shouldfail]" )
 {
     SUCCEED( "oops!" );
 }
+
+TEST_CASE( "# A test name that starts with a #" ) {
+    SUCCEED( "yay" );
+}