Merge topic 'test-bad-foreach-in-function'

fb114a40 Tests: Add test for bad foreach inside a function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1492
This commit is contained in:
Brad King
2017-11-17 15:13:50 +00:00
committed by Kitware Robot
6 changed files with 18 additions and 0 deletions
+1
View File
@@ -218,6 +218,7 @@ add_RunCMake_test(find_library)
add_RunCMake_test(find_package)
add_RunCMake_test(find_path)
add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
add_RunCMake_test(foreach)
add_RunCMake_test(get_filename_component)
add_RunCMake_test(get_property)
add_RunCMake_test(if)
@@ -0,0 +1 @@
1
@@ -0,0 +1,5 @@
^CMake Error at BadRangeInFunction.cmake:2 \(foreach\):
foreach called with incorrect range specification: start 2, stop 1, step 1
Call Stack \(most recent call first\):
BadRangeInFunction.cmake:5 \(func\)
CMakeLists.txt:3 \(include\)$
@@ -0,0 +1,5 @@
function(func)
foreach(bad_range RANGE 2 1 1)
endforeach()
endfunction()
func()
+3
View File
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.10)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
@@ -0,0 +1,3 @@
include(RunCMake)
run_cmake(BadRangeInFunction)