summaryrefslogtreecommitdiffstats
path: root/Tests/ReturnTest
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2012-08-13 17:50:14 (GMT)
committerBrad King <brad.king@kitware.com>2012-08-13 18:19:16 (GMT)
commit9db3116226cb99fcf54e936c833953abcde9b729 (patch)
treebd755ed9e616bbf1482a894bc7946980d81b7703 /Tests/ReturnTest
parent77543bde41b0e52c3959016698b529835945d62d (diff)
downloadCMake-9db3116226cb99fcf54e936c833953abcde9b729.zip
CMake-9db3116226cb99fcf54e936c833953abcde9b729.tar.gz
CMake-9db3116226cb99fcf54e936c833953abcde9b729.tar.bz2
Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block termination commands to have arguments matching the command starting the block. This is no longer the preferred style. Run the following shell code: for c in else endif endforeach endfunction endmacro endwhile; do echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/' done >convert.sed && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' | egrep -z -v '^(Utilities/cm|Source/kwsys/)' | egrep -z -v 'Tests/CMakeTests/While-Endwhile-' | xargs -0 sed -i -f convert.sed && rm convert.sed
Diffstat (limited to 'Tests/ReturnTest')
-rw-r--r--Tests/ReturnTest/CMakeLists.txt76
1 files changed, 38 insertions, 38 deletions
diff --git a/Tests/ReturnTest/CMakeLists.txt b/Tests/ReturnTest/CMakeLists.txt
index a08855e..3bd7ce0 100644
--- a/Tests/ReturnTest/CMakeLists.txt
+++ b/Tests/ReturnTest/CMakeLists.txt
@@ -4,24 +4,24 @@ project (ReturnTest)
function (FAILED testname)
message (SEND_ERROR "${testname} failed ${ARGN}")
-endfunction (FAILED)
+endfunction ()
function (PASS testname)
message ("${testname} passed ${ARGN}")
-endfunction (PASS)
+endfunction ()
# test simple return
function (simple)
set(simpleResult 1 PARENT_SCOPE)
return()
set(simpleResult 0 PARENT_SCOPE)
-endfunction (simple)
+endfunction ()
simple()
if ("${simpleResult}")
pass ("simple")
-else ("${simpleResult}")
+else ()
failed ("simple got: ${simpleResult}")
-endif ("${simpleResult}")
+endif ()
#test return in an if statement
set (simple2IF 1)
@@ -29,15 +29,15 @@ function (simple2)
set(simple2Result 1 PARENT_SCOPE)
if (simple2IF)
return()
- endif (simple2IF)
+ endif ()
set(simple2Result 0 PARENT_SCOPE)
-endfunction (simple2)
+endfunction ()
simple2()
if ("${simple2Result}")
pass ("simple2")
-else ("${simple2Result}")
+else ()
failed ("simple2 got: ${simple2Result}")
-endif ("${simple2Result}")
+endif ()
#test return in a foreach loop
function (looptest)
@@ -45,15 +45,15 @@ function (looptest)
set (looptestResult "${iter}" PARENT_SCOPE)
if ("${iter}" EQUAL 3)
return ()
- endif ("${iter}" EQUAL 3)
- endforeach (iter)
-endfunction (looptest)
+ endif ()
+ endforeach ()
+endfunction ()
looptest()
if ("${looptestResult}" EQUAL 3)
pass ("looptest")
-else ("${looptestResult}" EQUAL 3)
+else ()
failed ("looptest got: ${looptestResult}")
-endif ("${looptestResult}" EQUAL 3)
+endif ()
#test return in a while loop
function (whiletest)
@@ -62,58 +62,58 @@ function (whiletest)
set (whiletestResult "${iter}" PARENT_SCOPE)
if ("${iter}" STREQUAL "aaa")
return ()
- endif ("${iter}" STREQUAL "aaa")
+ endif ()
set (iter "${iter}a")
- endwhile(NOT "${iter}" STREQUAL "aaaaa")
-endfunction (whiletest)
+ endwhile()
+endfunction ()
whiletest()
if ("${whiletestResult}" STREQUAL "aaa")
pass ("whiletest")
-else ("${whiletestResult}" STREQUAL "aaa")
+else ()
failed ("whiletest got: ${whiletestResult}")
-endif ("${whiletestResult}" STREQUAL "aaa")
+endif ()
# check subdir return
add_subdirectory(subdir)
get_directory_property(subdirResult DIRECTORY subdir DEFINITION subdirreturn)
if ("${subdirResult}" EQUAL 1)
pass ("subdir")
-else ("${subdirResult}" EQUAL 1)
+else ()
failed ("subdir got: ${subdirResult}")
-endif ("${subdirResult}" EQUAL 1)
+endif ()
# check return from a file
include(include_return.cmake)
if ("${include_returnResult}" EQUAL 1)
pass ("include_return")
-else ("${include_returnResult}" EQUAL 1)
+else ()
failed ("include_return got: ${include_returnResult}")
-endif ("${include_returnResult}" EQUAL 1)
+endif ()
# check return from within a macro
macro (mymacro)
set (foo 1)
if (foo)
return()
- endif (foo)
-endmacro(mymacro)
+ endif ()
+endmacro()
# test simple return
function (simple3)
set (bar 0)
set(simple3Result 1 PARENT_SCOPE)
if (bar)
- else (bar)
+ else ()
mymacro()
- endif(bar)
+ endif()
set(simple3Result 0 PARENT_SCOPE)
-endfunction (simple3)
+endfunction ()
simple3()
if ("${simple3Result}")
pass ("macrotest")
-else ("${simple3Result}")
+else ()
failed ("macrotest got: ${simple3Result}")
-endif ("${simple3Result}")
+endif ()
# test break command now in a foreach
@@ -121,27 +121,27 @@ foreach (iter RANGE 1 5)
set (break1 "${iter}")
if ("${iter}" EQUAL 3)
break ()
- endif ("${iter}" EQUAL 3)
-endforeach (iter)
+ endif ()
+endforeach ()
if ("${break1}" EQUAL 3)
pass ("break in foreach")
-else ("${break1}" EQUAL 3)
+else ()
failed ("break in foreach got: ${break1}")
-endif ("${break1}" EQUAL 3)
+endif ()
# test break in a while loop
set (iter "a")
while(NOT "${iter}" STREQUAL "aaaaa")
if ("${iter}" STREQUAL "aaa")
break ()
- endif ("${iter}" STREQUAL "aaa")
+ endif ()
set (iter "${iter}a")
-endwhile(NOT "${iter}" STREQUAL "aaaaa")
+endwhile()
if ("${iter}" STREQUAL "aaa")
pass ("break in a while")
-else ("${iter}" STREQUAL "aaa")
+else ()
failed ("break in a whi;e got: ${whiletestResult}")
-endif ("${iter}" STREQUAL "aaa")
+endif ()
add_executable (ReturnTest returnTest.c)