diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-04-04 14:42:58 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2023-04-16 10:00:20 (GMT) |
commit | 31675964e7ba37f1412aaa95af4199e9b62e8c08 (patch) | |
tree | 7d53c8bdc2dbed748efa86750fe88358a92f325c /Tests/RunCMake/GenEx-LIST | |
parent | e256e35daa79732a200883cef398fcd0f8227a3d (diff) | |
download | CMake-31675964e7ba37f1412aaa95af4199e9b62e8c08.zip CMake-31675964e7ba37f1412aaa95af4199e9b62e8c08.tar.gz CMake-31675964e7ba37f1412aaa95af4199e9b62e8c08.tar.bz2 |
GenEx LIST: list operations
Fixes: #24550, #24547
Diffstat (limited to 'Tests/RunCMake/GenEx-LIST')
144 files changed, 1383 insertions, 0 deletions
diff --git a/Tests/RunCMake/GenEx-LIST/APPEND.cmake.in b/Tests/RunCMake/GenEx-LIST/APPEND.cmake.in new file mode 100644 index 0000000..19e1d12 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/APPEND.cmake.in @@ -0,0 +1,34 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(APPEND listvar e) +set (output "$<LIST:APPEND,a;b;c;d,e>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(APPEND listvar e f) +set (output "$<LIST:APPEND,a;b;c;d,e,f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(APPEND listvar e f) +set (output "$<LIST:APPEND,a;b;c;d,e;f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) +list(APPEND listvar e f) +set (output "$<LIST:APPEND,,e,f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:APPEND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/CMakeLists.txt b/Tests/RunCMake/GenEx-LIST/CMakeLists.txt new file mode 100644 index 0000000..5161b99 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.18...3.25) + +project(${RunCMake_TEST} NONE) + +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-result.txt b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-stderr.txt b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-stderr.txt new file mode 100644 index 0000000..3064c00 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at FILTER-wrong-operator.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:FILTER,a;b;c,WRONG_OPERATOR,\^a> + + sub-command FILTER does not recognize operator "WRONG_OPERATOR". It must + be either INCLUDE or EXCLUDE. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator.cmake b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator.cmake new file mode 100644 index 0000000..e01b4fe --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-operator.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:FILTER,a;b;c,WRONG_OPERATOR,^a>") diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-result.txt b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-stderr.txt b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-stderr.txt new file mode 100644 index 0000000..b2f9b8a --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at FILTER-wrong-regex.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:FILTER,a;b;c,INCLUDE,\^\(a> + + sub-command FILTER, failed to compile regex "\^\(a". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex.cmake b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex.cmake new file mode 100644 index 0000000..1311f31 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FILTER-wrong-regex.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:FILTER,a;b;c,INCLUDE,^(a>") diff --git a/Tests/RunCMake/GenEx-LIST/FIND.cmake.in b/Tests/RunCMake/GenEx-LIST/FIND.cmake.in new file mode 100644 index 0000000..e2242c3 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/FIND.cmake.in @@ -0,0 +1,20 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(FIND listvar "c" reference) +set (output "$<LIST:FIND,a;b;c;d,c>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(FIND listvar "e" reference) +set (output "$<LIST:FIND,a;b;c;d,e>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:FIND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-result.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-stderr.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-stderr.txt new file mode 100644 index 0000000..dcd1f2f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at GET-wrong-index1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:GET,,0> + + given empty list +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index1.cmake b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1.cmake new file mode 100644 index 0000000..4c395b3 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:GET,,0>") diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-result.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-stderr.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-stderr.txt new file mode 100644 index 0000000..20f1af4 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at GET-wrong-index2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:GET,a;b,2> + + index: 2 out of range \(-2, 1\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index2.cmake b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2.cmake new file mode 100644 index 0000000..28c97e2 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:GET,a;b,2>") diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-result.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-stderr.txt b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-stderr.txt new file mode 100644 index 0000000..a5dccbe --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at GET-wrong-index3.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:GET,a;b,1,-3> + + index: -3 out of range \(-2, 1\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/GET-wrong-index3.cmake b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3.cmake new file mode 100644 index 0000000..fd7be17 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET-wrong-index3.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:GET,a;b,1,-3>") diff --git a/Tests/RunCMake/GenEx-LIST/GET.cmake.in b/Tests/RunCMake/GenEx-LIST/GET.cmake.in new file mode 100644 index 0000000..102eb42 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/GET.cmake.in @@ -0,0 +1,20 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(GET listvar 0 2 reference) +set (output "$<LIST:GET,a;b;c;d,0,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(GET listvar 0 -3 2 reference) +set (output "$<LIST:GET,a;b;c;d,0,-3,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:GET..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-result.txt b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-stderr.txt b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-stderr.txt new file mode 100644 index 0000000..ce36fb1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at INSERT-wrong-index1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:INSERT,a;b;c,4,d> + + index: 4 out of range \(-3, 3\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1.cmake b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1.cmake new file mode 100644 index 0000000..ead5832 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:INSERT,a;b;c,4,d>") diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-result.txt b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-stderr.txt b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-stderr.txt new file mode 100644 index 0000000..f0ea1d7 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at INSERT-wrong-index2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:INSERT,a;b;c,-4,d> + + index: -4 out of range \(-3, 3\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2.cmake b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2.cmake new file mode 100644 index 0000000..c057b87 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT-wrong-index2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:INSERT,a;b;c,-4,d>") diff --git a/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in new file mode 100644 index 0000000..d3bb9b9 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/INSERT.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(INSERT listvar 1 e) +set (output "$<LIST:INSERT,a;b;c;d,1,e>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) + +list(INSERT listvar 2 e f) +set (output "$<LIST:INSERT,a;b;c;d,2,e,f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(INSERT listvar 0 e f) +set (output "$<LIST:INSERT,a;b;c;d,0,e;f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(INSERT listvar -2 e f) +set (output "$<LIST:INSERT,a;b;c;d,-2,e;f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(INSERT listvar 3 e f) +set (output "$<LIST:INSERT,a;b;c;d,3,e;f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) +list(INSERT listvar 0 e f) +set (output "$<LIST:INSERT,,0,e,f>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:INSERT..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/JOIN.cmake.in b/Tests/RunCMake/GenEx-LIST/JOIN.cmake.in new file mode 100644 index 0000000..0a56450 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/JOIN.cmake.in @@ -0,0 +1,35 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(JOIN listvar ":" reference) +set (output "$<LIST:JOIN,a;b;c;d,:>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(JOIN listvar "" reference) +set (output "$<LIST:JOIN,a;b;c;d,>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a) + +list(JOIN listvar ":" reference) +set (output "$<LIST:JOIN,a,:>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) + +list(JOIN listvar ":" reference) +set (output "$<LIST:JOIN,,:>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +check_errors("LIST:JOIN..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/LENGTH.cmake.in b/Tests/RunCMake/GenEx-LIST/LENGTH.cmake.in new file mode 100644 index 0000000..0840e11 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/LENGTH.cmake.in @@ -0,0 +1,30 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(LENGTH listvar reference) +set (output "$<LIST:LENGTH,a;b;c;d>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar "") + +list(LENGTH listvar reference) +set (output "$<LIST:LENGTH,>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) + +list(LENGTH listvar reference) +set (output "$<LIST:LENGTH,>") +if (NOT output EQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:LENGTH..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/POP_BACK.cmake.in b/Tests/RunCMake/GenEx-LIST/POP_BACK.cmake.in new file mode 100644 index 0000000..ba95c83 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/POP_BACK.cmake.in @@ -0,0 +1,18 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(POP_BACK listvar) +set (output "$<LIST:POP_BACK,a;b;c;d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:POP_BACK,>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:POP_BACK..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/POP_FRONT.cmake.in b/Tests/RunCMake/GenEx-LIST/POP_FRONT.cmake.in new file mode 100644 index 0000000..0d676af --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/POP_FRONT.cmake.in @@ -0,0 +1,18 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(POP_FRONT listvar) +set (output "$<LIST:POP_FRONT,a;b;c;d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:POP_FRONT,>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:POP_FRONT..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/PREPEND.cmake.in b/Tests/RunCMake/GenEx-LIST/PREPEND.cmake.in new file mode 100644 index 0000000..49b8f98 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/PREPEND.cmake.in @@ -0,0 +1,34 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(PREPEND listvar e) +set (output "$<LIST:PREPEND,a;b;c;d,e>") +if (NOT output STREQUAL listvar) + list (PREPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(PREPEND listvar e f) +set (output "$<LIST:PREPEND,a;b;c;d,e,f>") +if (NOT output STREQUAL listvar) + list (PREPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(PREPEND listvar e f) +set (output "$<LIST:PREPEND,a;b;c;d,e;f>") +if (NOT output STREQUAL listvar) + list (PREPEND errors "returns bad value: ${output}") +endif() + +unset(listvar) +list(PREPEND listvar e f) +set (output "$<LIST:PREPEND,,e,f>") +if (NOT output STREQUAL listvar) + list (PREPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:PREPEND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-result.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-stderr.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-stderr.txt new file mode 100644 index 0000000..b874f1d --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at REMOVE_AT-wrong-index1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:REMOVE_AT,,0> + + index: 0 out of range \(0, 0\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1.cmake b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1.cmake new file mode 100644 index 0000000..d87559e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:REMOVE_AT,,0>") diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-result.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-stderr.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-stderr.txt new file mode 100644 index 0000000..509eed4 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at REMOVE_AT-wrong-index2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:REMOVE_AT,a;b;c,3> + + index: 3 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2.cmake b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2.cmake new file mode 100644 index 0000000..7ecfad2 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:REMOVE_AT,a;b;c,3>") diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-result.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-stderr.txt b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-stderr.txt new file mode 100644 index 0000000..c8fc465 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at REMOVE_AT-wrong-index3.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:REMOVE_AT,a;b;c,-4> + + index: -4 out of range \(-3, 2\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3.cmake b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3.cmake new file mode 100644 index 0000000..f8f9a3e --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT-wrong-index3.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:REMOVE_AT,a;b;c,-4>") diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_AT.cmake.in b/Tests/RunCMake/GenEx-LIST/REMOVE_AT.cmake.in new file mode 100644 index 0000000..42a9476 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_AT.cmake.in @@ -0,0 +1,25 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(REMOVE_AT listvar 1 3) +set (output "$<LIST:REMOVE_AT,a;b;c;d,1,3>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(REMOVE_AT listvar 1 -2) +set (output "$<LIST:REMOVE_AT,a;b;c;d,1;-2>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:REMOVE_AT,a;b;c;d,1,0,3;2>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:REMOVE_AT..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_DUPLICATES.cmake.in b/Tests/RunCMake/GenEx-LIST/REMOVE_DUPLICATES.cmake.in new file mode 100644 index 0000000..8785ae5 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_DUPLICATES.cmake.in @@ -0,0 +1,20 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(REMOVE_DUPLICATES listvar) +set (output "$<LIST:REMOVE_DUPLICATES,a;b;c;d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar "b;c;b;a;a;c;b;a;c;b") +list(REMOVE_DUPLICATES listvar) +set (output "$<LIST:REMOVE_DUPLICATES,b;c;b;a;a;c;b;a;c;b>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:REMOVE_DUPLICATES..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/REMOVE_ITEM.cmake.in b/Tests/RunCMake/GenEx-LIST/REMOVE_ITEM.cmake.in new file mode 100644 index 0000000..5434a5d --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REMOVE_ITEM.cmake.in @@ -0,0 +1,32 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) +list(REMOVE_ITEM listvar b d) +set (output "$<LIST:REMOVE_ITEM,a;b;c;d,b,d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(REMOVE_ITEM listvar b e) +set (output "$<LIST:REMOVE_ITEM,a;b;c;d,b,e>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar a b c d) +list(REMOVE_ITEM listvar b a d c) +set (output "$<LIST:REMOVE_ITEM,a;b;c;d,b;a;d;c>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:REMOVE_ITEM,,b;a;d;c>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:REMOVE_ITEM..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/REVERSE.cmake.in b/Tests/RunCMake/GenEx-LIST/REVERSE.cmake.in new file mode 100644 index 0000000..295e1a3 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/REVERSE.cmake.in @@ -0,0 +1,19 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(REVERSE listvar) +set (output "$<LIST:REVERSE,a;b;c;d>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set (output "$<LIST:REVERSE,>") +if (NOT output STREQUAL "") + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:REVERSE..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/RunCMakeTest.cmake b/Tests/RunCMake/GenEx-LIST/RunCMakeTest.cmake new file mode 100644 index 0000000..1946e84 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/RunCMakeTest.cmake @@ -0,0 +1,130 @@ + +include(RunCMake) + +run_cmake(no-arguments) +run_cmake(bad-option) + +function(check_list_syntax name test) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-${test}-build) + set(RunCMake_TEST_VARIANT_DESCRIPTION " - ${name}") + run_cmake_with_options(${test} ${ARGN}) +endfunction() + +## Unexpected arguments +### sub-commands with one argument +foreach (subcommand IN ITEMS LENGTH POP_BACK POP_FRONT REMOVE_DUPLICATES REVERSE) + check_list_syntax (${subcommand} unexpected-arg "-DLIST_ARGUMENTS=${subcommand},ARG1,ARG2") +endforeach() + +### sub-commands with two arguments +foreach (subcommand IN ITEMS FIND JOIN) + check_list_syntax (${subcommand} unexpected-arg "-DLIST_ARGUMENTS=${subcommand},ARG1,ARG2,ARG3") +endforeach() + +### sub-commands with three arguments +foreach (subcommand IN ITEMS SUBLIST FILTER) + check_list_syntax (${subcommand} unexpected-arg "-DLIST_ARGUMENTS=${subcommand},ARG1,ARG2,ARG3,ARG4") +endforeach() + +# TRANSFORM sub-commands + set(RunCMake-stderr-file "TRANSFORM-unexpected-arg-stderr.txt") +foreach (action IN ITEMS TOLOWER TOUPPER STRIP) + check_list_syntax (TRANSFORM-${action} unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,${action},ARG2") +endforeach() +foreach (action IN ITEMS APPEND PREPEND) + check_list_syntax (TRANSFORM-${action} unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,${action},ARG2,ARG3") +endforeach() +foreach (action IN ITEMS REPLACE) + check_list_syntax (TRANSFORM-${action} unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,${action},ARG2,ARG3,ARG4") +endforeach() +check_list_syntax (TRANSFORM-SELECTOR-REGEX unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,STRIP,REGEX,ARG2,ARG3") +check_list_syntax (TRANSFORM-SELECTOR-FOR unexpected-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,STRIP,FOR,1,2,3,4") +unset(RunCMake-stderr-file) + +## Missing arguments +### sub-command with, at least, two arguments +foreach (subcommand IN ITEMS GET APPEND PREPEND REMOVE_ITEM REMOVE_AT TRANSFORM) + check_list_syntax (${subcommand} missing-arg "-DLIST_ARGUMENTS=${subcommand},ARG1") +endforeach() + +### sub-command with, at least, three arguments +foreach (subcommand IN ITEMS INSERT) + check_list_syntax (${subcommand} missing-arg "-DLIST_ARGUMENTS=${subcommand},ARG1,ARG2") +endforeach() + +# TRANSFORM sub-commands +set(RunCMake-stderr-file "TRANSFORM-missing-arg-stderr.txt") +foreach (action IN ITEMS APPEND PREPEND) + check_list_syntax (TRANSFORM-${action} missing-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,${action}") +endforeach() +check_list_syntax (TRANSFORM-REPLACE-1 missing-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,REPLACE,ARG2") +check_list_syntax (TRANSFORM-REPLACE-2 missing-arg "-DLIST_ARGUMENTS=TRANSFORM,ARG1,REPLACE") +unset(RunCMake-stderr-file) + + +run_cmake(GET-wrong-index1) +run_cmake(GET-wrong-index2) +run_cmake(GET-wrong-index3) +run_cmake(SUBLIST-wrong-argument1) +run_cmake(SUBLIST-wrong-argument2) +run_cmake(INSERT-wrong-index1) +run_cmake(INSERT-wrong-index2) +run_cmake(REMOVE_AT-wrong-index1) +run_cmake(REMOVE_AT-wrong-index2) +run_cmake(REMOVE_AT-wrong-index3) +run_cmake(FILTER-wrong-operator) +run_cmake(FILTER-wrong-regex) +run_cmake(TRANSFORM-wrong-action) +run_cmake(TRANSFORM-REPLACE-wrong-regex) +run_cmake(TRANSFORM-REPLACE-invalid-replace1) +run_cmake(TRANSFORM-REPLACE-invalid-replace2) +run_cmake(TRANSFORM-selector-REGEX-no-arguments) +run_cmake(TRANSFORM-selector-REGEX-wrong-regex) +run_cmake(TRANSFORM-selector-AT-no-arguments) +run_cmake(TRANSFORM-selector-AT-wrong-argument) +run_cmake(TRANSFORM-selector-AT-wrong-index) +run_cmake(TRANSFORM-selector-FOR-no-arguments) +run_cmake(TRANSFORM-selector-FOR-missing-arguments) +run_cmake(TRANSFORM-selector-FOR-wrong-argument) +run_cmake(TRANSFORM-selector-FOR-wrong-index) +run_cmake(TRANSFORM-selector-FOR-zero-step) +run_cmake(TRANSFORM-selector-FOR-negative-step) +run_cmake(TRANSFORM-selector-FOR-backwards-range) +run_cmake(SORT-wrong-option) +run_cmake(SORT-wrong-COMPARE-option) +run_cmake(SORT-wrong-CASE-option) +run_cmake(SORT-wrong-ORDER-option) +run_cmake(SORT-duplicate-COMPARE-option) +run_cmake(SORT-duplicate-CASE-option) +run_cmake(SORT-duplicate-ORDER-option) + + +function(check_list_execution name) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${name}-build) + set(RunCMake_TEST_NO_CLEAN 1) + set(RunCMake_TEST_VARIANT_DESCRIPTION " - ${name}") + run_cmake_with_options(generate -DLIST_TEST=${name}) + run_cmake_command(check "${CMAKE_COMMAND}" "-DRunCMake_SOURCE_DIR=${RunCMake_SOURCE_DIR}" -P "${RunCMake_TEST_BINARY_DIR}/${name}.cmake") +endfunction() + +check_list_execution (LENGTH) +check_list_execution (GET) +check_list_execution (JOIN) +check_list_execution (SUBLIST) +check_list_execution (FIND) +check_list_execution (APPEND) +check_list_execution (PREPEND) +check_list_execution (INSERT) +check_list_execution (POP_BACK) +check_list_execution (POP_FRONT) +check_list_execution (REMOVE_ITEM) +check_list_execution (REMOVE_AT) +check_list_execution (REMOVE_DUPLICATES) +check_list_execution (TRANSFORM-TOUPPER) +check_list_execution (TRANSFORM-TOLOWER) +check_list_execution (TRANSFORM-STRIP) +check_list_execution (TRANSFORM-APPEND) +check_list_execution (TRANSFORM-PREPEND) +check_list_execution (TRANSFORM-REPLACE) +check_list_execution (REVERSE) +check_list_execution (SORT) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-stderr.txt new file mode 100644 index 0000000..4f3121a --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SORT-duplicate-CASE-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:STRING,CASE:SENSITIVE,CASE:SENSITIVE> + + sub-command SORT, CASE option has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option.cmake new file mode 100644 index 0000000..e09dc6c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-CASE-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:STRING,CASE:SENSITIVE,CASE:SENSITIVE>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-stderr.txt new file mode 100644 index 0000000..fbb96bb --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SORT-duplicate-COMPARE-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:STRING,COMPARE:NATURAL> + + sub-command SORT, COMPARE option has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option.cmake new file mode 100644 index 0000000..cf8da0d --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-COMPARE-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:STRING,COMPARE:NATURAL>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-stderr.txt new file mode 100644 index 0000000..b45034a --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SORT-duplicate-ORDER-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,ORDER:ASCENDING,COMPARE:STRING,ORDER:DESCENDING,CASE:SENSITIVE> + + sub-command SORT, ORDER option has been specified multiple times. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option.cmake new file mode 100644 index 0000000..3826072 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-duplicate-ORDER-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,ORDER:ASCENDING,COMPARE:STRING,ORDER:DESCENDING,CASE:SENSITIVE>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-stderr.txt new file mode 100644 index 0000000..d36e63b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at SORT-wrong-CASE-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:STRING,CASE:WRONG_OPTION> + + sub-command SORT, an invalid CASE option has been specified: + "WRONG_OPTION". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option.cmake new file mode 100644 index 0000000..58df9ea --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-CASE-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:STRING,CASE:WRONG_OPTION>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-stderr.txt new file mode 100644 index 0000000..70a99c6 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at SORT-wrong-COMPARE-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:WRONG_OPTION> + + sub-command SORT, an invalid COMPARE option has been specified: + "WRONG_OPTION". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option.cmake new file mode 100644 index 0000000..73727bb --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-COMPARE-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:WRONG_OPTION>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-stderr.txt new file mode 100644 index 0000000..2e23d8c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at SORT-wrong-ORDER-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,COMPARE:STRING,CASE:SENSITIVE,ORDER:WRONG_OPTION> + + sub-command SORT, an invalid ORDER option has been specified: + "WRONG_OPTION". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option.cmake new file mode 100644 index 0000000..135c935 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-ORDER-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,COMPARE:STRING,CASE:SENSITIVE,ORDER:WRONG_OPTION>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-result.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-stderr.txt new file mode 100644 index 0000000..3c2d492 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SORT-wrong-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SORT,a;b,WRONG_OPTION> + + sub-command SORT, option "WRONG_OPTION" is invalid. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SORT-wrong-option.cmake b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option.cmake new file mode 100644 index 0000000..fca268b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT-wrong-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SORT,a;b,WRONG_OPTION>") diff --git a/Tests/RunCMake/GenEx-LIST/SORT.cmake.in b/Tests/RunCMake/GenEx-LIST/SORT.cmake.in new file mode 100644 index 0000000..aca6691 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SORT.cmake.in @@ -0,0 +1,92 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(source_unsorted c/B.h a/c.h B/a.h) + +set(listvar ${source_unsorted}) +list(SORT listvar) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE INSENSITIVE ORDER ASCENDING COMPARE STRING) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:INSENSITIVE,ORDER:ASCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE INSENSITIVE ORDER DESCENDING COMPARE STRING) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:INSENSITIVE,ORDER:DESCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE SENSITIVE ORDER ASCENDING COMPARE STRING) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:SENSITIVE,ORDER:ASCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE SENSITIVE ORDER DESCENDING COMPARE STRING) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:SENSITIVE,ORDER:DESCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE INSENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:INSENSITIVE,ORDER:ASCENDING,COMPARE:FILE_BASENAME>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE INSENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:INSENSITIVE,ORDER:DESCENDING,COMPARE:FILE_BASENAME>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE SENSITIVE ORDER ASCENDING COMPARE FILE_BASENAME) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:SENSITIVE,ORDER:ASCENDING,COMPARE:FILE_BASENAME>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar ${source_unsorted}) +list(SORT listvar CASE SENSITIVE ORDER DESCENDING COMPARE FILE_BASENAME) +set (output "$<LIST:SORT,c/B.h;a/c.h;B/a.h,CASE:SENSITIVE,ORDER:DESCENDING,COMPARE:FILE_BASENAME>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar 10.0 1.1 2.1 8.0 2.0 3.1) +list(SORT listvar CASE SENSITIVE ORDER DESCENDING COMPARE STRING) +set (output "$<LIST:SORT,10.0;1.1;2.1;8.0;2.0;3.1,CASE:SENSITIVE,ORDER:DESCENDING,COMPARE:STRING>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar 10.0 1.1 2.1 8.0 2.0 3.1) +list(SORT listvar CASE SENSITIVE ORDER DESCENDING COMPARE NATURAL) +set (output "$<LIST:SORT,10.0;1.1;2.1;8.0;2.0;3.1,CASE:SENSITIVE,ORDER:DESCENDING,COMPARE:NATURAL>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + +set(listvar 10.0 1.1 2.1 8.0 2.0 3.1) +list(SORT listvar CASE SENSITIVE ORDER ASCENDING COMPARE NATURAL) +set (output "$<LIST:SORT,10.0;1.1;2.1;8.0;2.0;3.1,CASE:SENSITIVE,ORDER:ASCENDING,COMPARE:NATURAL>") +if (NOT output STREQUAL listvar) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:SORT..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-result.txt b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-stderr.txt b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-stderr.txt new file mode 100644 index 0000000..078f345 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SUBLIST-wrong-argument1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SUBLIST,a;b;c,3,-1> + + begin index: 3 is out of range 0 - 2 +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1.cmake b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1.cmake new file mode 100644 index 0000000..293c2ae --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SUBLIST,a;b;c,3,-1>") diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-result.txt b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-stderr.txt b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-stderr.txt new file mode 100644 index 0000000..7271b30 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at SUBLIST-wrong-argument2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:SUBLIST,a;b;c,1,-2> + + length: -2 should be -1 or greater +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2.cmake b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2.cmake new file mode 100644 index 0000000..9d1db53 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST-wrong-argument2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:SUBLIST,a;b;c,1,-2>") diff --git a/Tests/RunCMake/GenEx-LIST/SUBLIST.cmake.in b/Tests/RunCMake/GenEx-LIST/SUBLIST.cmake.in new file mode 100644 index 0000000..9fcb6d5 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/SUBLIST.cmake.in @@ -0,0 +1,32 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar a b c d) + +list(SUBLIST listvar 1 2 reference) +set (output "$<LIST:SUBLIST,a;b;c;d,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(SUBLIST listvar 1 -1 reference) +set (output "$<LIST:SUBLIST,a;b;c;d,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(SUBLIST listvar 1 0 reference) +set (output "$<LIST:SUBLIST,a;b;c;d,1,0>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(SUBLIST listvar 1 5 reference) +set (output "$<LIST:SUBLIST,a;b;c;d,1,5>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:SUBLIST..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-APPEND.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-APPEND.cmake.in new file mode 100644 index 0000000..a6529ec --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-APPEND.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar alpha bravo charlie delta) + +list(TRANSFORM listvar APPEND "_A" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar APPEND "_A" REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,APPEND,_A,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,APPEND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-PREPEND.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-PREPEND.cmake.in new file mode 100644 index 0000000..5ec6acd --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-PREPEND.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar alpha bravo charlie delta) + +list(TRANSFORM listvar PREPEND "P_" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar PREPEND "P_" REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,PREPEND,P_,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,PREPEND..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-stderr.txt new file mode 100644 index 0000000..6674b30 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-REPLACE-invalid-replace1.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,REPLACE,\^a,b\\> + + sub-command TRANSFORM, action REPLACE: replace-expression ends in a + backslash. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1.cmake new file mode 100644 index 0000000..d45e1fd --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace1.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,REPLACE,^a,b\\>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-stderr.txt new file mode 100644 index 0000000..2351b72 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-REPLACE-invalid-replace2.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,REPLACE,\^a,\\b> + + sub-command TRANSFORM, action REPLACE: Unknown escape "\\b" in + replace-expression. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2.cmake new file mode 100644 index 0000000..b800f24 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-invalid-replace2.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,REPLACE,^a,\\b>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-stderr.txt new file mode 100644 index 0000000..617c3d6 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-REPLACE-wrong-regex.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,REPLACE,\(a,b> + + sub-command TRANSFORM, action REPLACE: Failed to compile regex "\(a". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex.cmake new file mode 100644 index 0000000..941e3e7 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE-wrong-regex.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,REPLACE,(a,b>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE.cmake.in new file mode 100644 index 0000000..5fba231 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-REPLACE.cmake.in @@ -0,0 +1,50 @@ + +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}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-STRIP.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-STRIP.cmake.in new file mode 100644 index 0000000..860faec --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-STRIP.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar " alpha" "bravo " " charlie " delta) + +list(TRANSFORM listvar STRIP OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar STRIP REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM, alpha;bravo ; charlie ;delta,STRIP,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,STRIP..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOLOWER.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOLOWER.cmake.in new file mode 100644 index 0000000..43e9955 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOLOWER.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar ALPHA BRAVO CHARLIE DELTA) + +list(TRANSFORM listvar TOLOWER OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOLOWER REGEX "(R|T)A" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,ALPHA;BRAVO;CHARLIE;DELTA,TOLOWER,REGEX,(R|T)A>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,TOLOWER..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOUPPER.cmake.in b/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOUPPER.cmake.in new file mode 100644 index 0000000..be2bc30 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-TOUPPER.cmake.in @@ -0,0 +1,50 @@ + +include ("${RunCMake_SOURCE_DIR}/check_errors.cmake") +unset (errors) + +set(listvar alpha bravo charlie delta) + +list(TRANSFORM listvar TOUPPER OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER AT 1 3 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,AT,1,3>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER AT 1 -2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,AT,1,-2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER FOR 1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,FOR,1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER FOR 1 -1 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,FOR,1,-1>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER FOR 1 -1 2 OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,FOR,1,-1,2>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + +list(TRANSFORM listvar TOUPPER REGEX "(r|t)a" OUTPUT_VARIABLE reference) +set (output "$<LIST:TRANSFORM,alpha;bravo;charlie;delta,TOUPPER,REGEX,(r|t)a>") +if (NOT output STREQUAL reference) + list (APPEND errors "returns bad value: ${output}") +endif() + + +check_errors("LIST:TRANSFORM,TOUPPER..." ${errors}) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-missing-arg-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-missing-arg-stderr.txt new file mode 100644 index 0000000..46e36c3 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-missing-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at missing-arg.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,ARG1,[A-Z]+(,ARG[0-9])?> + + sub-command TRANSFORM, action [A-Z]+ expects (1|2) argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-stderr.txt new file mode 100644 index 0000000..69b4915 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-AT-no-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,AT> + + sub-command TRANSFORM, selector AT expects at least one numeric value. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments.cmake new file mode 100644 index 0000000..2447511 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,AT>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-stderr.txt new file mode 100644 index 0000000..40007a1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-AT-wrong-argument.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,AT,0,1x,2> + + sub-command TRANSFORM, selector AT: '1x': unexpected argument. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument.cmake new file mode 100644 index 0000000..49f4e90 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-argument.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,AT,0,1x,2>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-stderr.txt new file mode 100644 index 0000000..66085ab --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-AT-wrong-index.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,AT,0,3,2> + + sub-command TRANSFORM, selector AT, index: 3 out of range \(-3, 2\). +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index.cmake new file mode 100644 index 0000000..fd6c3ed --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-AT-wrong-index.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,AT,0,3,2>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-stderr.txt new file mode 100644 index 0000000..77cffdc --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-selector-FOR-backwards-range.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,2,0> + + sub-command TRANSFORM, selector FOR expects <start> to be no greater than + <stop> \(2 > 0\) +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range.cmake new file mode 100644 index 0000000..17f57f5 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-backwards-range.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,2,0>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-stderr.txt new file mode 100644 index 0000000..a9de7f8 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-FOR-missing-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,FOR,0> + + sub-command TRANSFORM, selector FOR expects, at least, two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments.cmake new file mode 100644 index 0000000..5ae481a --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-missing-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,FOR,0>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-stderr.txt new file mode 100644 index 0000000..9c81de4 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-selector-FOR-negative-step.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,2,-1> + + sub-command TRANSFORM, selector FOR expects positive numeric value for + <step>. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step.cmake new file mode 100644 index 0000000..b8e6433 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-negative-step.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,2,-1>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-stderr.txt new file mode 100644 index 0000000..d31f171 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-FOR-no-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,FOR> + + sub-command TRANSFORM, selector FOR expects, at least, two arguments. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments.cmake new file mode 100644 index 0000000..6545ff9 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,FOR>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-stderr.txt new file mode 100644 index 0000000..727be10 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-FOR-wrong-argument.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,1x,2> + + sub-command TRANSFORM, selector FOR expects, at least, two numeric values. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument.cmake new file mode 100644 index 0000000..a50b62c --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-argument.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,1x,2>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-stderr.txt new file mode 100644 index 0000000..664e35a --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-FOR-wrong-index.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,4,2> + + sub-command TRANSFORM, selector FOR, index: 4 out of range \(-3, 2\). +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index.cmake new file mode 100644 index 0000000..f35bfbf --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-wrong-index.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,4,2>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-stderr.txt new file mode 100644 index 0000000..e542fbf --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-selector-FOR-zero-step.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,2,0> + + sub-command TRANSFORM, selector FOR expects positive numeric value for + <step>. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step.cmake new file mode 100644 index 0000000..2bfaab0 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-FOR-zero-step.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,TOUPPER,FOR,0,2,0>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-stderr.txt new file mode 100644 index 0000000..079172b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments-stderr.txt @@ -0,0 +1,9 @@ +CMake Error at TRANSFORM-selector-REGEX-no-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,REGEX> + + sub-command TRANSFORM, selector REGEX expects 'regular expression' + argument. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments.cmake new file mode 100644 index 0000000..1f802b7 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,REGEX>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-stderr.txt new file mode 100644 index 0000000..3fe2b01 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at TRANSFORM-selector-REGEX-wrong-regex.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b,TOUPPER,REGEX,\(a> + + sub-command TRANSFORM, selector REGEX failed to compile regex "\(a". +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex.cmake new file mode 100644 index 0000000..1648092 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-selector-REGEX-wrong-regex.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b,TOUPPER,REGEX,(a>") diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-unexpected-arg-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-unexpected-arg-stderr.txt new file mode 100644 index 0000000..04e9df1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-unexpected-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at unexpected-arg.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,ARG1,[A-Z_]+(,[A-Z0-9]+)+> + + sub-command TRANSFORM, '[A-Z0-9]+': unexpected argument\(s\). +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-result.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-stderr.txt b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-stderr.txt new file mode 100644 index 0000000..1c30c4f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action-stderr.txt @@ -0,0 +1,7 @@ +CMake Error at TRANSFORM-wrong-action.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:TRANSFORM,a;b;c,WRONG_ACTION> + sub-command TRANSFORM, WRONG_ACTION invalid action. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action.cmake b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action.cmake new file mode 100644 index 0000000..fba6c90 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/TRANSFORM-wrong-action.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:TRANSFORM,a;b;c,WRONG_ACTION>") diff --git a/Tests/RunCMake/GenEx-LIST/bad-option-result.txt b/Tests/RunCMake/GenEx-LIST/bad-option-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/bad-option-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/bad-option-stderr.txt b/Tests/RunCMake/GenEx-LIST/bad-option-stderr.txt new file mode 100644 index 0000000..37048c5 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/bad-option-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at bad-option.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:BAD_OPTION,ARG> + + BAD_OPTION: invalid option. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/bad-option.cmake b/Tests/RunCMake/GenEx-LIST/bad-option.cmake new file mode 100644 index 0000000..d1dc85f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/bad-option.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:BAD_OPTION,ARG>") diff --git a/Tests/RunCMake/GenEx-LIST/check_errors.cmake b/Tests/RunCMake/GenEx-LIST/check_errors.cmake new file mode 100644 index 0000000..7e60fc7 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/check_errors.cmake @@ -0,0 +1,13 @@ + +function (CHECK_ERRORS command) + set (errors ${ARGN}) + set (command "$<${command}>") + if (errors) + string (LENGTH "${command}" length) + math (EXPR count "${length} + 2") + string (REPEAT " " ${count} shift) + list (TRANSFORM errors PREPEND "${shift}") + list (JOIN errors "\n" msg) + message (FATAL_ERROR "${command}: ${msg}") + endif() +endfunction() diff --git a/Tests/RunCMake/GenEx-LIST/generate.cmake b/Tests/RunCMake/GenEx-LIST/generate.cmake new file mode 100644 index 0000000..92cdca2 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/generate.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT "${LIST_TEST}.cmake" INPUT "${LIST_TEST}.cmake.in") diff --git a/Tests/RunCMake/GenEx-LIST/missing-arg-result.txt b/Tests/RunCMake/GenEx-LIST/missing-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/missing-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/missing-arg-stderr.txt b/Tests/RunCMake/GenEx-LIST/missing-arg-stderr.txt new file mode 100644 index 0000000..c7cbe4b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/missing-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at missing-arg.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:[A-Z_]+,.+> + + \$<LIST:[A-Z_]+> expression requires at least (two|three) parameters. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/missing-arg.cmake b/Tests/RunCMake/GenEx-LIST/missing-arg.cmake new file mode 100644 index 0000000..48b26e1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/missing-arg.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:${LIST_ARGUMENTS}>") diff --git a/Tests/RunCMake/GenEx-LIST/no-arguments-result.txt b/Tests/RunCMake/GenEx-LIST/no-arguments-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/no-arguments-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/no-arguments-stderr.txt b/Tests/RunCMake/GenEx-LIST/no-arguments-stderr.txt new file mode 100644 index 0000000..ee782ec --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/no-arguments-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at no-arguments.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:> + + \$<LIST> expression requires at least two parameters. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/no-arguments.cmake b/Tests/RunCMake/GenEx-LIST/no-arguments.cmake new file mode 100644 index 0000000..f704e2b --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/no-arguments.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:>") diff --git a/Tests/RunCMake/GenEx-LIST/unexpected-arg-result.txt b/Tests/RunCMake/GenEx-LIST/unexpected-arg-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/unexpected-arg-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/GenEx-LIST/unexpected-arg-stderr.txt b/Tests/RunCMake/GenEx-LIST/unexpected-arg-stderr.txt new file mode 100644 index 0000000..a7b1f25 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/unexpected-arg-stderr.txt @@ -0,0 +1,8 @@ +CMake Error at unexpected-arg.cmake:[0-9]+ \(file\): + Error evaluating generator expression: + + \$<LIST:[A-Z_]+,.+> + + \$<LIST:[A-Z_]+(,[A-Z_]+)?> expression requires exactly (one|two|three) parameters?. +Call Stack \(most recent call first\): + CMakeLists.txt:[0-9]+ \(include\) diff --git a/Tests/RunCMake/GenEx-LIST/unexpected-arg.cmake b/Tests/RunCMake/GenEx-LIST/unexpected-arg.cmake new file mode 100644 index 0000000..48b26e1 --- /dev/null +++ b/Tests/RunCMake/GenEx-LIST/unexpected-arg.cmake @@ -0,0 +1,2 @@ + +file(GENERATE OUTPUT result.txt CONTENT "$<LIST:${LIST_ARGUMENTS}>") |