summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/return
diff options
context:
space:
mode:
authorGregor Jasny <gjasny@googlemail.com>2014-11-18 15:34:29 (GMT)
committerBrad King <brad.king@kitware.com>2014-11-25 19:37:39 (GMT)
commitd124c41168cb509e32a31d09c1008bcb6a3d1d7d (patch)
tree626e6418b26374c15d96d1c0b708cb22b08bce85 /Tests/RunCMake/return
parent66ba7ea831ca8d44b137e59e8271de3c7756cfe3 (diff)
downloadCMake-d124c41168cb509e32a31d09c1008bcb6a3d1d7d.zip
CMake-d124c41168cb509e32a31d09c1008bcb6a3d1d7d.tar.gz
CMake-d124c41168cb509e32a31d09c1008bcb6a3d1d7d.tar.bz2
return: Add test for returning inside a foreach loop
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
Diffstat (limited to 'Tests/RunCMake/return')
-rw-r--r--Tests/RunCMake/return/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/return/ReturnFromForeach-result.txt1
-rw-r--r--Tests/RunCMake/return/ReturnFromForeach.cmake10
-rw-r--r--Tests/RunCMake/return/RunCMakeTest.cmake3
4 files changed, 17 insertions, 0 deletions
diff --git a/Tests/RunCMake/return/CMakeLists.txt b/Tests/RunCMake/return/CMakeLists.txt
new file mode 100644
index 0000000..ef2163c
--- /dev/null
+++ b/Tests/RunCMake/return/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.1)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/return/ReturnFromForeach-result.txt b/Tests/RunCMake/return/ReturnFromForeach-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/return/ReturnFromForeach-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/return/ReturnFromForeach.cmake b/Tests/RunCMake/return/ReturnFromForeach.cmake
new file mode 100644
index 0000000..c71cf33
--- /dev/null
+++ b/Tests/RunCMake/return/ReturnFromForeach.cmake
@@ -0,0 +1,10 @@
+function(foo)
+ foreach(i RANGE 1 3)
+ foreach(j RANGE 1 3)
+ return()
+ message(FATAL_ERROR "unexpected")
+ endforeach()
+ endforeach()
+endfunction(foo)
+
+foo()
diff --git a/Tests/RunCMake/return/RunCMakeTest.cmake b/Tests/RunCMake/return/RunCMakeTest.cmake
new file mode 100644
index 0000000..2cc6c9d
--- /dev/null
+++ b/Tests/RunCMake/return/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(ReturnFromForeach)