Browse files

fix ctest output with space before name

When PARSE_CATCH_TESTS_ADD_TARGET_IN_TEST_NAME is enabled the cmake helper script fails to extract the testcase name if a whitespace is before the name string. Use regex to consider and remove this whitespace.

fix by Mike-Devel
fixes: #1493
  • Loading branch information...
NeroBurner authored and horenmar committed Jan 10, 2019
1 parent bdee512 commit 3ed544106777af0d96b9190468b0823f9d481d0e
Showing with 1 addition and 1 deletion.
  1. +1 −1 contrib/ParseAndAddCatchTests.cmake
@@ -109,7 +109,7 @@ function(ParseFile SourceFile TestTarget)
# Get test type and fixture if applicable
string(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)[ \t]*\\([^,^\"]*" TestTypeAndFixture "${TestName}")
string(REPLACE "${TestType}(" "" TestFixture "${TestTypeAndFixture}")
string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")

# Get string parts of test definition
string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")

0 comments on commit 3ed5441

Please sign in to comment.