From b1eeec7c6976ac23b3d28986eff93d605a7f12e7 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Tue, 27 Sep 2016 10:27:28 +0100 Subject: [PATCH] -f supports quoted test names (test name surrounded with " characters). This is the first part to resolving #717 --- 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" ); +}