diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2016-09-28 19:20:42 (GMT) |
---|---|---|
committer | Matthew Woehlke <matthew.woehlke@kitware.com> | 2016-09-28 19:20:42 (GMT) |
commit | 66c70cd9f1eb69b03cefe7fbe8e238aaa4630f47 (patch) | |
tree | 68392c9b8aa273322032e71ea1a4851c25c3ec65 /Tests/RunCMake/cmake_parse_arguments/test_utils.cmake | |
parent | 41291b20f3881cac781e5e628f8b892b29c7b39c (diff) | |
download | CMake-66c70cd9f1eb69b03cefe7fbe8e238aaa4630f47.zip CMake-66c70cd9f1eb69b03cefe7fbe8e238aaa4630f47.tar.gz CMake-66c70cd9f1eb69b03cefe7fbe8e238aaa4630f47.tar.bz2 |
cmake_parse_arguments: Add additional unit tests
Add additional unit tests for some corner cases in argument splitting.
Diffstat (limited to 'Tests/RunCMake/cmake_parse_arguments/test_utils.cmake')
-rw-r--r-- | Tests/RunCMake/cmake_parse_arguments/test_utils.cmake | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake b/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake index f5425c2..9ce99b8 100644 --- a/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake +++ b/Tests/RunCMake/cmake_parse_arguments/test_utils.cmake @@ -1,20 +1,30 @@ -macro(TEST variable) - SET(expected "${ARGN}") - if ( "${expected}" STREQUAL "UNDEFINED" ) - if (DEFINED ${variable}) - message(FATAL_ERROR "'${variable}' shall be undefined but has value '${${variable}}'") - endif() - elseif( "${expected}" STREQUAL "FALSE" ) - if (NOT ${variable} STREQUAL "FALSE") - message(FATAL_ERROR "'${variable}' shall be FALSE") - endif() - elseif( "${expected}" STREQUAL "TRUE" ) - if (NOT ${variable} STREQUAL "TRUE") - message(FATAL_ERROR "'${variable}' shall be TRUE") - endif() +function(TEST variable) + if(ARGC GREATER 2) + set(i 0) + foreach(value IN LISTS ${variable}) + math(EXPR j "${i} + 1") + set(${variable}[${i}] "${value}") + TEST(${variable}[${i}] "${ARGV${j}}") + set(i ${j}) + endforeach() else() - if (NOT ${variable} STREQUAL "${expected}") - message(FATAL_ERROR "'${variable}' shall be '${expected}'") + set(expected "${ARGN}") + if("${expected}" STREQUAL "UNDEFINED") + if(DEFINED ${variable}) + message(FATAL_ERROR "'${variable}' shall be undefined but has value '${${variable}}'") + endif() + elseif("${expected}" STREQUAL "FALSE") + if(NOT ${variable} STREQUAL "FALSE") + message(FATAL_ERROR "'${variable}' shall be FALSE") + endif() + elseif("${expected}" STREQUAL "TRUE") + if(NOT ${variable} STREQUAL "TRUE") + message(FATAL_ERROR "'${variable}' shall be TRUE") + endif() + else() + if(NOT ${variable} STREQUAL "${expected}") + message(FATAL_ERROR "'${variable}' shall be '${expected}'") + endif() endif() endif() -endmacro() +endfunction() |