diff --git a/Help/release/dev/googletest-listseparator.rst b/Help/release/dev/googletest-listseparator.rst deleted file mode 100644 index 50a98ac070..0000000000 --- a/Help/release/dev/googletest-listseparator.rst +++ /dev/null @@ -1,5 +0,0 @@ -googletest-listseparator ------------------------- - -* The :module:`GoogleTest` module :command:`gtest_discover_tests` command - gained a ``LIST_SEPARATOR`` option. diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 496301b605..6db0d67f14 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -174,7 +174,6 @@ same as the Google Test name (i.e. ``suite.testcase``); see also [TEST_SUFFIX suffix] [TEST_FILTER expr] [NO_PRETTY_TYPES] [NO_PRETTY_VALUES] - [LIST_SEPARATOR sep] [PROPERTIES name1 value1...] [TEST_LIST var] [DISCOVERY_TIMEOUT seconds] @@ -329,14 +328,6 @@ same as the Google Test name (i.e. ``suite.testcase``); see also :prop_tgt:`CROSSCOMPILING_EMULATOR` target properties are preserved, see policy :policy:`CMP0178`. - ``LIST_SEPARATOR`` - .. versionadded:: 4.4 - - By default, ``PROPERTIES`` key-value pairs cannot have lists as their - values. By providing a non-semicolon character delimiter, it is possible to - pass lists as property values. Note that when doing so, the chosen character - cannot appear in any of the property values. - #]=======================================================================] # Save project's policies @@ -571,7 +562,6 @@ function(gtest_discover_tests target) DISCOVERY_TIMEOUT XML_OUTPUT_DIR DISCOVERY_MODE - LIST_SEPARATOR ) set(multiValueArgs EXTRA_ARGS diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 576b122173..c10c80a047 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -108,6 +108,12 @@ macro(write_test_to_file) set(maybe_LOCATION "DEF_SOURCE_LINE [==[${current_test_file}:${current_test_line}]==]") endif() + set(maybe_properties) + if(arg_TEST_PROPERTIES) + list(JOIN arg_TEST_PROPERTIES "]] [[" maybe_properties) + set(maybe_properties "[[${maybe_properties}]]") + endif() + string(APPEND script "set_tests_properties(${guarded_testname}\n" " PROPERTIES\n" @@ -115,30 +121,9 @@ macro(write_test_to_file) " ${maybe_LOCATION}\n" " WORKING_DIRECTORY [==[${arg_TEST_WORKING_DIR}]==]\n" " SKIP_REGULAR_EXPRESSION [==[\\[ SKIPPED \\]]==]\n" + " ${maybe_properties}\n" + ")\n" ) - if(arg_TEST_PROPERTIES) - # Making local copy of arg_TEST_PROPERTIES, as write_test_to_file is - # called in a loop and we don't want to destroy the parsed arg value - # by POP_FRONT-ing from it. - set(test_properties "${arg_TEST_PROPERTIES}") - list(LENGTH test_properties test_properties_length) - math(EXPR test_properties_length_mod2 "${test_properties_length} % 2") - if(NOT test_properties_length_mod2 EQUAL 0) - message(FATAL_ERROR - "gtest_discover_tests() received a key-value list of properties with an uneven number of elements.\n" - "Check the supplied TEST_PROPERTIES argument and LIST_SEPARATOR if used." - ) - endif() - while(NOT test_properties_length EQUAL 0) - list(POP_FRONT test_properties property_name property_value) - list(LENGTH test_properties test_properties_length) - if(NOT "${arg_LIST_SEPARATOR}" STREQUAL "") - string(REPLACE "${arg_LIST_SEPARATOR}" ";" property_value "${property_value}") - endif() - string(APPEND script " ${property_name} [==[${property_value}]==]\n") - endwhile() - endif() - string(APPEND script ")\n") # possibly unbalanced square brackets render lists invalid so skip such # tests in ${arg_TEST_LIST} @@ -287,7 +272,6 @@ function(gtest_discover_tests_impl) set(oneValueArgs NO_PRETTY_TYPES # These two take a value, unlike gtest_discover_tests() NO_PRETTY_VALUES # - LIST_SEPARATOR TEST_TARGET TEST_EXECUTABLE TEST_WORKING_DIR diff --git a/Tests/GoogleTest/Test/CMakeLists.txt b/Tests/GoogleTest/Test/CMakeLists.txt index 43848c0ef6..024e99756e 100644 --- a/Tests/GoogleTest/Test/CMakeLists.txt +++ b/Tests/GoogleTest/Test/CMakeLists.txt @@ -115,14 +115,11 @@ if(NOT TEST GoogleTest.NoKeywords) message(FATAL_ERROR "Test case GoogleTest.NoKeywords not defined") endif() -# Check if LIST_SEPARATOR allows passing both ENVIRONMENT values to test +# Check if PROPERTIES values are allowed to be lists add_executable(test_gtest5 main5.cxx) target_link_libraries(test_gtest5 GTest::Main) set(environment VALX=1 VALY=2) -set(list_separator ",") -list(JOIN environment ${list_separator} environment) gtest_discover_tests(test_gtest5 - LIST_SEPARATOR ${list_separator} PROPERTIES ENVIRONMENT "${environment}" )