You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start 1: name
1/1 Test #1: name ......................................... Passed 0.01 sec
When executing ctest from the command line, this is merely looking strange, but when using Visual studio with the open folder functionality, the test explorer doesn't even show the tests.
I think this is related to some advanced functionality, that I'm not using, so I'm not sure how exactly to fix that, but a workaround for me is the following patch:
@@ -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(REGEX MATCH "(CATCH_)?(TEST_CASE_METHOD|SCENARIO|TEST_CASE)" TestType "${TestTypeAndFixture}")
- string(REPLACE "${TestType}(" "" TestFixture "${TestTypeAndFixture}")
+ string(REGEX REPLACE "${TestType}\\([ \t]*" "" TestFixture "${TestTypeAndFixture}")
# Get string parts of test definition
string(REGEX MATCHALL "\"+([^\\^\"]|\\\\\")+\"+" TestStrings "${TestName}")
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: catchorg#1493
Description
My test case headers are formatted like this:
note the space between
TEST_CASE(
and"name"
.That leads to an output in ctest like this:
when I would expect it to output
When executing ctest from the command line, this is merely looking strange, but when using Visual studio with the open folder functionality, the test explorer doesn't even show the tests.
I think this is related to some advanced functionality, that I'm not using, so I'm not sure how exactly to fix that, but a workaround for me is the following patch:
Steps to reproduce
main.cpp:
CMakeLists.txt:
on console:
Extra information
The text was updated successfully, but these errors were encountered: