summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeTests
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-08-17 09:47:20 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2023-08-17 10:07:41 (GMT)
commit45ed175f0898fb407dbc327b660449e1d773c197 (patch)
tree200c770e0bfa3f0c742e98574b358a67530aa44a /Tests/CMakeTests
parenta69c783749f769f41875ff818c68ead277fd24f9 (diff)
downloadCMake-45ed175f0898fb407dbc327b660449e1d773c197.zip
CMake-45ed175f0898fb407dbc327b660449e1d773c197.tar.gz
CMake-45ed175f0898fb407dbc327b660449e1d773c197.tar.bz2
list(INSERT): restore old behavior
Fixes: #25191
Diffstat (limited to 'Tests/CMakeTests')
-rw-r--r--Tests/CMakeTests/ListTest.cmake.in21
1 files changed, 21 insertions, 0 deletions
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in
index 76737e5..0120c84 100644
--- a/Tests/CMakeTests/ListTest.cmake.in
+++ b/Tests/CMakeTests/ListTest.cmake.in
@@ -161,3 +161,24 @@ foreach (_pol ${thelist})
message(SEND_ERROR "returned element '${thevalue}', but expected '${_pol}'")
endif()
endforeach (_pol)
+
+block(SCOPE_FOR POLICIES)
+ cmake_policy(SET CMP0007 NEW)
+ set(result andy bill brad ken bob)
+ list(INSERT result 1 "")
+ TEST("INSERT result 1 \"\"" "andy;;bill;brad;ken;bob")
+ list(INSERT result 4 ";")
+ TEST("INSERT result 1 ;" "andy;;bill;brad;;;ken;bob")
+ list(INSERT result 0 "x")
+ TEST("INSERT result 1 x" "x;andy;;bill;brad;;;ken;bob")
+endblock()
+block(SCOPE_FOR POLICIES)
+ cmake_policy(SET CMP0007 OLD)
+ set(result andy bill brad ken bob)
+ list(INSERT result 1 "")
+ TEST("INSERT result 1 \"\"" "andy;;bill;brad;ken;bob")
+ list(INSERT result 4 ";")
+ TEST("INSERT result 1 ;" "andy;bill;brad;ken;;;bob")
+ list(INSERT result 0 "x")
+ TEST("INSERT result 1 x" "x;andy;bill;brad;ken;bob")
+endblock()