diff options
Diffstat (limited to 'Tests/CMakeTests/ListTest.cmake.in')
-rw-r--r-- | Tests/CMakeTests/ListTest.cmake.in | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index 48b157c..58a8435 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -1,8 +1,8 @@ MACRO(TEST command expected) IF("x${result}" STREQUAL "x${expected}") - MESSAGE("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") + #MESSAGE("TEST \"${command}\" success: \"${result}\" expected: \"${expected}\"") ELSE("x${result}" STREQUAL "x${expected}") - MESSAGE(SEND_ERROR "TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") + MESSAGE(SEND_ERROR "${CMAKE_CURRENT_LIST_LINE}: TEST \"${command}\" failed: \"${result}\" expected: \"${expected}\"") ENDIF("x${result}" STREQUAL "x${expected}") ENDMACRO(TEST command expected) @@ -13,6 +13,9 @@ TEST("LENGTH mylist result" "4") LIST(LENGTH "mylist" result) TEST("LENGTH \"mylist\" result" "4") +LIST(LENGTH "nonexiting_list1" result) +TEST("LENGTH \"nonexiting_list1\" result" "0") + LIST(GET mylist 3 2 1 0 result) TEST("GET mylist 3 2 1 0 result" "brad;ken;bill;andy") @@ -29,22 +32,37 @@ TEST("GET mylist -1 -2 -3 -4 result" "brad;ken;bill;andy") LIST(GET mylist -1 2 -3 0 result) TEST("GET mylist -1 2 -3 0 ${result}" "brad;ken;bill;andy") +LIST(GET "nonexiting_list2" 1 result) +TEST("GET \"nonexiting_list2\" 1 result" "NOTFOUND") + SET(result andy) -LIST(SET result brad) -TEST("SET result brad" "andy;brad") +LIST(APPEND result brad) +TEST("APPEND result brad" "andy;brad") + +LIST(APPEND "nonexiting_list3" brad) +SET(result "${nonexiting_list3}") +TEST("APPEND \"nonexiting_list3\" brad" "brad") + +LIST(INSERT "nonexiting_list4" 0 andy bill brad ken) +SET(result "${nonexiting_list4}") +TEST("APPEND \"nonexiting_list4\" andy bill brad ken" "andy;bill;brad;ken") SET(result andy brad) LIST(INSERT result -1 bill ken) TEST("INSERT result -1 bill ken" "andy;bill;ken;brad") SET(result andy bill brad ken bob) -LIST(REMOVE result bob) -TEST("REMOVE result bob" "andy;bill;brad;ken") +LIST(REMOVE_ITEM result bob) +TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") SET(result andy bill bob brad ken peter) -LIST(REMOVE result peter bob) -TEST("REMOVE result peter bob" "andy;bill;brad;ken") +LIST(REMOVE_ITEM result peter bob) +TEST("REMOVE_ITEM result peter bob" "andy;bill;brad;ken") + +SET(result bob andy bill bob brad ken bob) +LIST(REMOVE_ITEM result bob) +TEST("REMOVE_ITEM result bob" "andy;bill;brad;ken") SET(result andy bill bob brad ken peter) -LIST(REMOVE_ITEM result 2 -1) -TEST("REMOVE_ITEM result 2 -1" "andy;bill;brad;ken") +LIST(REMOVE_AT result 2 -1) +TEST("REMOVE_AT result 2 -1" "andy;bill;brad;ken") |