summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-02-27 18:54:42 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-02-27 19:52:06 (GMT)
commit185d1aefaa209115d21c6c821ff85f64411e95de (patch)
tree3cdb8491c92fa55e004054966c0cc646c8a3d076 /Tests
parenta33b3949e5337da978828d611f3ca3f08bcda21b (diff)
downloadCMake-185d1aefaa209115d21c6c821ff85f64411e95de.zip
CMake-185d1aefaa209115d21c6c821ff85f64411e95de.tar.gz
CMake-185d1aefaa209115d21c6c821ff85f64411e95de.tar.bz2
foreach: Set fatal error on invalid range
Fixes: #20394
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/foreach/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/foreach/foreach-RANGE-invalid-test-result.txt1
-rw-r--r--Tests/RunCMake/foreach/foreach-RANGE-invalid-test-stderr.txt4
-rw-r--r--Tests/RunCMake/foreach/foreach-RANGE-invalid-test.cmake2
4 files changed, 8 insertions, 0 deletions
diff --git a/Tests/RunCMake/foreach/RunCMakeTest.cmake b/Tests/RunCMake/foreach/RunCMakeTest.cmake
index 6bb0683..22a0a75 100644
--- a/Tests/RunCMake/foreach/RunCMakeTest.cmake
+++ b/Tests/RunCMake/foreach/RunCMakeTest.cmake
@@ -18,3 +18,4 @@ run_cmake(foreach-RANGE-non-int-test-2-2)
run_cmake(foreach-RANGE-non-int-test-3-1)
run_cmake(foreach-RANGE-non-int-test-3-2)
run_cmake(foreach-RANGE-non-int-test-3-3)
+run_cmake(foreach-RANGE-invalid-test)
diff --git a/Tests/RunCMake/foreach/foreach-RANGE-invalid-test-result.txt b/Tests/RunCMake/foreach/foreach-RANGE-invalid-test-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/foreach/foreach-RANGE-invalid-test-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/foreach/foreach-RANGE-invalid-test-stderr.txt b/Tests/RunCMake/foreach/foreach-RANGE-invalid-test-stderr.txt
new file mode 100644
index 0000000..66efdc1
--- /dev/null
+++ b/Tests/RunCMake/foreach/foreach-RANGE-invalid-test-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at foreach-RANGE-invalid-test\.cmake:[0-9]+ \(foreach\):
+ foreach called with incorrect range specification: start 2, stop 1, step 1
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:3 \(include\)$
diff --git a/Tests/RunCMake/foreach/foreach-RANGE-invalid-test.cmake b/Tests/RunCMake/foreach/foreach-RANGE-invalid-test.cmake
new file mode 100644
index 0000000..2f8eaba
--- /dev/null
+++ b/Tests/RunCMake/foreach/foreach-RANGE-invalid-test.cmake
@@ -0,0 +1,2 @@
+foreach(a RANGE 2 1 1)
+endforeach()