diff options
author | Marc Chevrier <marc.chevrier@sap.com> | 2018-03-16 13:12:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-03-21 16:54:53 (GMT) |
commit | 768225837db303e8b568e39ade730eea8ac6b573 (patch) | |
tree | 8438f1112f7eae9ee54afbbdd958af55f57e94c2 /Tests/RunCMake/list/SUBLIST.cmake | |
parent | d41abae70f282c718f3109b7f76644adce41ff37 (diff) | |
download | CMake-768225837db303e8b568e39ade730eea8ac6b573.zip CMake-768225837db303e8b568e39ade730eea8ac6b573.tar.gz CMake-768225837db303e8b568e39ade730eea8ac6b573.tar.bz2 |
list: Add SUBLIST sub-command
Issue: #17823
Diffstat (limited to 'Tests/RunCMake/list/SUBLIST.cmake')
-rw-r--r-- | Tests/RunCMake/list/SUBLIST.cmake | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Tests/RunCMake/list/SUBLIST.cmake b/Tests/RunCMake/list/SUBLIST.cmake new file mode 100644 index 0000000..fd15c28 --- /dev/null +++ b/Tests/RunCMake/list/SUBLIST.cmake @@ -0,0 +1,46 @@ +set(mylist alpha bravo charlie delta) +list(SUBLIST mylist 1 2 result) + +if (NOT result STREQUAL "bravo;charlie") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie\"") +endif() + + +unset(result) +list(SUBLIST mylist 0 2 result) + +if (NOT result STREQUAL "alpha;bravo") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"alpha;bravo\"") +endif() + + +unset(result) +list(SUBLIST mylist 3 2 result) + +if (NOT result STREQUAL "delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"delta\"") +endif() + + +unset(result) +list(SUBLIST mylist 2 0 result) +list(LENGTH result length) +if (NOT length EQUAL 0) + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is an empty list") +endif() + + +unset(result) +list(SUBLIST mylist 1 5 result) + +if (NOT result STREQUAL "bravo;charlie;delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie;delta\"") +endif() + + +unset(result) +list(SUBLIST mylist 1 -1 result) + +if (NOT result STREQUAL "bravo;charlie;delta") + message (FATAL_ERROR "SUBLIST is \"${result}\", expected is \"bravo;charlie;delta\"") +endif() |