summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-08-19 12:36:58 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-08-19 12:37:09 (GMT)
commit4ee45988cb0dd8345b803e7e5979d600684fc8ae (patch)
treee16e071465d48c6d03f35844a608a0e64af5f141 /Tests/RunCMake
parent4f91cbba26f079932bf3f0ba15c7f52b6c9b565b (diff)
parent45ed175f0898fb407dbc327b660449e1d773c197 (diff)
downloadCMake-4ee45988cb0dd8345b803e7e5979d600684fc8ae.zip
CMake-4ee45988cb0dd8345b803e7e5979d600684fc8ae.tar.gz
CMake-4ee45988cb0dd8345b803e7e5979d600684fc8ae.tar.bz2
Merge topic 'cmList-INSERT-regression'
45ed175f08 list(INSERT): restore old behavior Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !8732
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r--Tests/RunCMake/GenEx-LIST/INSERT.cmake.in47
1 files changed, 47 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in
index d3bb9b9..48add61 100644
--- a/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in
+++ b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in
@@ -46,5 +46,52 @@ if (NOT output STREQUAL listvar)
list (APPEND errors "returns bad value: ${output}")
endif()
+block(SCOPE_FOR POLICIES)
+ cmake_policy(SET CMP0007 NEW)
+
+ set(listvar "0;1;2;3;4")
+ list(INSERT listvar 1 "")
+ set (output "$<LIST:INSERT,0;1;2;3;4,1,>")
+ if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+ endif()
+
+ list(INSERT listvar 4 ";")
+ set (output "$<LIST:INSERT,0;;1;2;3;4,4,;>")
+ if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+ endif()
+
+ list(INSERT listvar 0 "x")
+ set (output "$<LIST:INSERT,0;;1;2;;;3;4,0,x>")
+ if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+ endif()
+endblock()
+block(SCOPE_FOR POLICIES)
+ set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "")
+ cmake_policy(SET CMP0007 OLD)
+
+ set(listvar "0;1;2;3;4")
+ list(INSERT listvar 1 "")
+ set (output "$<LIST:INSERT,0;1;2;3;4,1,>")
+ if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+ endif()
+
+ list(INSERT listvar 4 ";")
+ set (output "$<LIST:INSERT,0;1;2;3;4,4,;>")
+ if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+ endif()
+
+ list(INSERT listvar 0 "x")
+ set (output "$<LIST:INSERT,0;1;2;3;4,0,x>")
+ if (NOT output STREQUAL listvar)
+ list (APPEND errors "returns bad value: ${output}")
+ endif()
+
+ unset(CMAKE_WARN_DEPRECATED CACHE)
+endblock()
check_errors("LIST:INSERT..." ${errors})