diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2012-03-01 20:12:55 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2012-03-01 20:20:49 (GMT) |
commit | 944b90be60ab7888a76d76acbb0200f511db3d60 (patch) | |
tree | c558713c0014e786d02da3150cc5fe825a166af2 | |
parent | f605b92dec414311936ff62afb0ab7847f08974e (diff) | |
download | CMake-944b90be60ab7888a76d76acbb0200f511db3d60.zip CMake-944b90be60ab7888a76d76acbb0200f511db3d60.tar.gz CMake-944b90be60ab7888a76d76acbb0200f511db3d60.tar.bz2 |
add testcases for while()/endwhile() errors
-rw-r--r-- | Tests/CMakeTests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CMakeTests/While-Endwhile-Alone-Args.cmake | 1 | ||||
-rw-r--r-- | Tests/CMakeTests/While-Endwhile-Alone.cmake | 1 | ||||
-rw-r--r-- | Tests/CMakeTests/While-Endwhile-Mismatch.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/While-Missing-Argument.cmake | 1 | ||||
-rw-r--r-- | Tests/CMakeTests/While-Missing-Endwhile.cmake | 1 | ||||
-rw-r--r-- | Tests/CMakeTests/WhileTest.cmake.in | 53 |
7 files changed, 60 insertions, 0 deletions
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index fc1426e..aa4d52e 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -29,6 +29,7 @@ AddCMakeTest(CMakeMinimumRequired "") AddCMakeTest(CompilerIdVendor "") AddCMakeTest(ProcessorCount "") AddCMakeTest(PushCheckState "") +AddCMakeTest(While "") AddCMakeTest(FileDownload "") set_property(TEST CMake.FileDownload PROPERTY diff --git a/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake b/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake new file mode 100644 index 0000000..886d98c --- /dev/null +++ b/Tests/CMakeTests/While-Endwhile-Alone-Args.cmake @@ -0,0 +1 @@ +endwhile(a) diff --git a/Tests/CMakeTests/While-Endwhile-Alone.cmake b/Tests/CMakeTests/While-Endwhile-Alone.cmake new file mode 100644 index 0000000..82c09a0 --- /dev/null +++ b/Tests/CMakeTests/While-Endwhile-Alone.cmake @@ -0,0 +1 @@ +endwhile() diff --git a/Tests/CMakeTests/While-Endwhile-Mismatch.cmake b/Tests/CMakeTests/While-Endwhile-Mismatch.cmake new file mode 100644 index 0000000..5c338d6 --- /dev/null +++ b/Tests/CMakeTests/While-Endwhile-Mismatch.cmake @@ -0,0 +1,2 @@ +while(a) +endwhile(b) diff --git a/Tests/CMakeTests/While-Missing-Argument.cmake b/Tests/CMakeTests/While-Missing-Argument.cmake new file mode 100644 index 0000000..32eaa26 --- /dev/null +++ b/Tests/CMakeTests/While-Missing-Argument.cmake @@ -0,0 +1 @@ +while() diff --git a/Tests/CMakeTests/While-Missing-Endwhile.cmake b/Tests/CMakeTests/While-Missing-Endwhile.cmake new file mode 100644 index 0000000..1abaaaf --- /dev/null +++ b/Tests/CMakeTests/While-Missing-Endwhile.cmake @@ -0,0 +1 @@ +while(a) diff --git a/Tests/CMakeTests/WhileTest.cmake.in b/Tests/CMakeTests/WhileTest.cmake.in new file mode 100644 index 0000000..4693f2d --- /dev/null +++ b/Tests/CMakeTests/WhileTest.cmake.in @@ -0,0 +1,53 @@ +set(NUMBERS "") +set(COUNT 0) + +while(COUNT LESS 200) + set(NUMBERS "${NUMBERS} ${COUNT}") + set(COUNT "2${COUNT}") + + set(NCOUNT 3) + while(NCOUNT LESS 31) + set(NUMBERS "${NUMBERS} ${NCOUNT}") + set(NCOUNT "${NCOUNT}0") + endwhile() +endwhile(COUNT LESS 200) + +if(NOT NUMBERS STREQUAL " 0 3 30 20 3 30") + message(SEND_ERROR "while loop nesting error, result: '${NUMBERS}'") +endif() + +set(Missing-Argument-RESULT 1) +set(Missing-Argument-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Argument.cmake:1 \\(while\\):.*while called with incorrect number of arguments.*") + +include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake") +check_cmake_test(While + Missing-Argument +) + +set(Missing-Endwhile-RESULT 1) +set(Missing-Endwhile-STDERR ".*CMake Error in (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Endwhile.cmake:.*A logical block opening on the line.*(@CMAKE_CURRENT_SOURCE_DIR@/)?While-Missing-Endwhile.cmake:1 \\(while\\).*is not closed\\..*") + +check_cmake_test(While + Missing-Endwhile +) + +set(Endwhile-Mismatch-RESULT 0) +set(Endwhile-Mismatch-STDERR ".*CMake Warning \\(dev\\) in (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Mismatch.cmake:.*A logical block opening on the line.*(@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Mismatch.cmake:1 \\(while\\).*with mis-matching arguments\\..*") + +check_cmake_test(While + Endwhile-Mismatch +) + +set(Endwhile-Alone-RESULT 1) +set(Endwhile-Alone-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Alone.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\.\n.*$") + +check_cmake_test(While + Endwhile-Alone +) + +set(Endwhile-Alone-Args-RESULT 1) +set(Endwhile-Alone-Args-STDERR ".*CMake Error at (@CMAKE_CURRENT_SOURCE_DIR@/)?While-Endwhile-Alone-Args.cmake:1 \\(endwhile\\):.*An ENDWHILE command was found outside of a proper WHILE ENDWHILE.*structure\\. Or its arguments did not.*$") + +check_cmake_test(While + Endwhile-Alone-Args +) |