diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2018-03-26 12:32:12 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@sap.com> | 2018-04-16 15:11:53 (GMT) |
commit | dca2347980862d803c182bb5898b5bfaca54aa62 (patch) | |
tree | 2cc95f9ed2d017bc1eddb7446b60b2be3e8f04dc /Tests/RunCMake/list/TRANSFORM-APPEND.cmake | |
parent | cdae12f8f86730e075598118ebe5fd2f11746af7 (diff) | |
download | CMake-dca2347980862d803c182bb5898b5bfaca54aa62.zip CMake-dca2347980862d803c182bb5898b5bfaca54aa62.tar.gz CMake-dca2347980862d803c182bb5898b5bfaca54aa62.tar.bz2 |
list: Add TRANSFORM sub-command
Issue: #17823
Diffstat (limited to 'Tests/RunCMake/list/TRANSFORM-APPEND.cmake')
-rw-r--r-- | Tests/RunCMake/list/TRANSFORM-APPEND.cmake | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/Tests/RunCMake/list/TRANSFORM-APPEND.cmake b/Tests/RunCMake/list/TRANSFORM-APPEND.cmake new file mode 100644 index 0000000..9639088 --- /dev/null +++ b/Tests/RunCMake/list/TRANSFORM-APPEND.cmake @@ -0,0 +1,48 @@ +set(mylist alpha bravo charlie delta) + +list(TRANSFORM mylist APPEND "_A" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha_A;bravo_A;charlie_A;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha_A;bravo_A;charlie_A;delta_A\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" AT 1 3 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie;delta_A\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" AT 1 -2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie_A;delta") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie_A;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" FOR 1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie_A;delta") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie_A;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" FOR 1 -1 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie_A;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie_A;delta_A\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" FOR 0 -1 2 OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha_A;bravo;charlie_A;delta") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha_A;bravo;charlie_A;delta\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" REGEX "(r|t)a" OUTPUT_VARIABLE output) +if (NOT output STREQUAL "alpha;bravo_A;charlie;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${output}\", expected is \"alpha;bravo_A;charlie;delta_A\"") +endif() + +unset(output) +list(TRANSFORM mylist APPEND "_A" REGEX "(r|t)a") +if (NOT mylist STREQUAL "alpha;bravo_A;charlie;delta_A") + message (FATAL_ERROR "TRANSFORM(APPEND) is \"${mylist}\", expected is \"alpha;bravo_A;charlie;delta_A\"") +endif() |