You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cmake/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE.cmake.in

51 lines
2.0 KiB

include ("${RunCMake_SOURCE_DIR}/check_errors.cmake")
unset (errors)
set(listvar alpha bravo charlie delta)
list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" OUTPUT_VARIABLE reference)
set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1>")
if (NOT output STREQUAL reference)
list (APPEND errors "returns bad value: ${output}")
endif()
list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" AT 1 3 OUTPUT_VARIABLE reference)
set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,AT,1,3>")
if (NOT output STREQUAL reference)
list (APPEND errors "returns bad value: ${output}")
endif()
list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" AT 1 -2 OUTPUT_VARIABLE reference)
set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,AT,1,-2>")
if (NOT output STREQUAL reference)
list (APPEND errors "returns bad value: ${output}")
endif()
list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" FOR 1 2 OUTPUT_VARIABLE reference)
set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,FOR,1,2>")
if (NOT output STREQUAL reference)
list (APPEND errors "returns bad value: ${output}")
endif()
list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" FOR 1 -1 OUTPUT_VARIABLE reference)
set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,FOR,1,-1>")
if (NOT output STREQUAL reference)
list (APPEND errors "returns bad value: ${output}")
endif()
list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" FOR 1 -1 2 OUTPUT_VARIABLE reference)
set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,FOR,1,-1,2>")
if (NOT output STREQUAL reference)
list (APPEND errors "returns bad value: ${output}")
endif()
list(TRANSFORM listvar REPLACE "(.+a)$" "\\1_\\1" REGEX "(r|t)a" OUTPUT_VARIABLE reference)
set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,REPLACE,(.+a)$,\1_\1,REGEX,(r|t)a>")
if (NOT output STREQUAL reference)
list (APPEND errors "returns bad value: ${output}")
endif()
check_errors("LIST:TRANSFORM,REPLACE..." ${errors})