GoogleTestAddTests fails parsing if parameter contains semicolon
When using gtest_discover_tests
, CMake reads the test list from the generated executable.
This output contains the parameters passed on to the test in the output, if test suites are used. If these parameters contain some special characters (especially ;
), the parsing fails.
Example: CMakeLists.txt, main.cpp.
The output of the test list is:
% ./test_error --gtest_list_tests
Parameter/ParamTest.
Dummy/0 # GetParam() = "a;b"
Dummy/1 # GetParam() = "a\xFF"
CTest gives this output:
Test project /home/steef/dev/blub/build
Start 1: Parameter/ParamTest.Dummy/"a
1/2 Test #1: Parameter/ParamTest.Dummy/"a ..... Passed 0.00 sec
Start 2: b".Dummy/"a\xFF"
2/2 Test #2: b".Dummy/"a\xFF" ................. Passed 0.00 sec
Both tests aren't detected correctly, the first is cut off and the second one starts after the semicolon.
On checking the XML-log, we can see, that the successful second run never executed any actual test.