return: Add test for returning inside a foreach loop
Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
This commit is contained in:
parent
66ba7ea831
commit
d124c41168
@ -110,6 +110,7 @@ add_RunCMake_test(include_directories)
|
||||
add_RunCMake_test(list)
|
||||
add_RunCMake_test(message)
|
||||
add_RunCMake_test(project)
|
||||
add_RunCMake_test(return)
|
||||
add_RunCMake_test(string)
|
||||
add_RunCMake_test(try_compile)
|
||||
add_RunCMake_test(set)
|
||||
|
3
Tests/RunCMake/return/CMakeLists.txt
Normal file
3
Tests/RunCMake/return/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
1
Tests/RunCMake/return/ReturnFromForeach-result.txt
Normal file
1
Tests/RunCMake/return/ReturnFromForeach-result.txt
Normal file
@ -0,0 +1 @@
|
||||
0
|
10
Tests/RunCMake/return/ReturnFromForeach.cmake
Normal file
10
Tests/RunCMake/return/ReturnFromForeach.cmake
Normal file
@ -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()
|
3
Tests/RunCMake/return/RunCMakeTest.cmake
Normal file
3
Tests/RunCMake/return/RunCMakeTest.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(ReturnFromForeach)
|
Loading…
x
Reference in New Issue
Block a user