summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorEvgeniy Shcherbina <ixsci@pm.me>2022-02-07 07:35:21 (GMT)
committerBrad King <brad.king@kitware.com>2022-02-07 17:53:17 (GMT)
commit073dd1bd8131a337d3022a6bdc75af0114588093 (patch)
tree290facbaa5aecdec0537f357ae0be0760298f246 /Modules
parentf28f738bd2be2ed790bb5b4c794773b7a627d3f2 (diff)
downloadCMake-073dd1bd8131a337d3022a6bdc75af0114588093.zip
CMake-073dd1bd8131a337d3022a6bdc75af0114588093.tar.gz
CMake-073dd1bd8131a337d3022a6bdc75af0114588093.tar.bz2
GoogleTest: Change format for typed tests
Before it would output a typed test as follows: Suit/Type.Case And now it would be: Suit.Case<Type> In case of NO_PRETTY_TYPES it would simply use the type number instead of its text representation: Suit.Case<0> The change is introduced to make sure CTest outputs tests in a similar fashion which is "*Suit.Case*" and angle brackets "<>" emphasize that we are dealing with a typed (template) kind.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/GoogleTestAddTests.cmake13
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake
index 671127a..cef2e8a 100644
--- a/Modules/GoogleTestAddTests.cmake
+++ b/Modules/GoogleTestAddTests.cmake
@@ -135,10 +135,17 @@ function(gtest_discover_tests_impl)
if(NOT line MATCHES "^ ")
# Module; remove trailing '.' to get just the name...
string(REGEX REPLACE "\\.( *#.*)?$" "" suite "${line}")
- if(line MATCHES "#" AND NOT _NO_PRETTY_TYPES)
- string(REGEX REPLACE "/[0-9]+\\.+ +#.*= +" "/" pretty_suite "${line}")
+ if(line MATCHES "#")
+ string(REGEX REPLACE "/.*" "" pretty_suite "${line}")
+ if(NOT _NO_PRETTY_TYPES)
+ string(REGEX REPLACE ".*/[0-9]+[ .#]+TypeParam = (.*)" "\\1" type_parameter "${line}")
+ else()
+ string(REGEX REPLACE ".*/([0-9]+)[ .#]+TypeParam = .*" "\\1" type_parameter "${line}")
+ endif()
+ set(test_name_template "@prefix@@pretty_suite@.@pretty_test@<@type_parameter@>@suffix@")
else()
set(pretty_suite "${suite}")
+ set(test_name_template "@prefix@@pretty_suite@.@pretty_test@@suffix@")
endif()
string(REGEX REPLACE "^DISABLED_" "" pretty_suite "${pretty_suite}")
else()
@@ -156,7 +163,7 @@ function(gtest_discover_tests_impl)
unset(TEST_XML_OUTPUT_PARAM)
endif()
- set(testname "${prefix}${pretty_suite}.${pretty_test}${suffix}")
+ string(CONFIGURE "${test_name_template}" testname)
# sanitize test name for further processing downstream
# unescape []
if(open_sb)