summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-22 13:24:35 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-03-22 13:24:49 (GMT)
commit5d2f30f5acbcf572a464f6f45fafaea23c7ae75a (patch)
tree75d2ab147b055a443e68b86ac29eba17b3fab761 /Tests
parente24ed7ad870730304431f5cb09d90c980136639c (diff)
parentedac95b955afdea2d129b32b029bf845dc29cb71 (diff)
downloadCMake-5d2f30f5acbcf572a464f6f45fafaea23c7ae75a.zip
CMake-5d2f30f5acbcf572a464f6f45fafaea23c7ae75a.tar.gz
CMake-5d2f30f5acbcf572a464f6f45fafaea23c7ae75a.tar.bz2
Merge topic '14335-duplicate-else'
edac95b9 cmIfCommand: Reject duplicate else() and misplaced elseif() Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !594
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/if/RunCMakeTest.cmake4
-rw-r--r--Tests/RunCMake/if/duplicate-deep-else-result.txt1
-rw-r--r--Tests/RunCMake/if/duplicate-deep-else-stderr.txt4
-rw-r--r--Tests/RunCMake/if/duplicate-deep-else.cmake7
-rw-r--r--Tests/RunCMake/if/duplicate-else-after-elseif-result.txt1
-rw-r--r--Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt4
-rw-r--r--Tests/RunCMake/if/duplicate-else-after-elseif.cmake5
-rw-r--r--Tests/RunCMake/if/duplicate-else-result.txt1
-rw-r--r--Tests/RunCMake/if/duplicate-else-stderr.txt4
-rw-r--r--Tests/RunCMake/if/duplicate-else.cmake4
-rw-r--r--Tests/RunCMake/if/misplaced-elseif-result.txt1
-rw-r--r--Tests/RunCMake/if/misplaced-elseif-stderr.txt4
-rw-r--r--Tests/RunCMake/if/misplaced-elseif.cmake4
13 files changed, 44 insertions, 0 deletions
diff --git a/Tests/RunCMake/if/RunCMakeTest.cmake b/Tests/RunCMake/if/RunCMakeTest.cmake
index 077d00a..f54edf7 100644
--- a/Tests/RunCMake/if/RunCMakeTest.cmake
+++ b/Tests/RunCMake/if/RunCMakeTest.cmake
@@ -3,7 +3,11 @@ include(RunCMake)
run_cmake(InvalidArgument1)
run_cmake(IsDirectory)
run_cmake(IsDirectoryLong)
+run_cmake(duplicate-deep-else)
+run_cmake(duplicate-else)
+run_cmake(duplicate-else-after-elseif)
run_cmake(elseif-message)
+run_cmake(misplaced-elseif)
run_cmake(MatchesSelf)
diff --git a/Tests/RunCMake/if/duplicate-deep-else-result.txt b/Tests/RunCMake/if/duplicate-deep-else-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-deep-else-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/if/duplicate-deep-else-stderr.txt b/Tests/RunCMake/if/duplicate-deep-else-stderr.txt
new file mode 100644
index 0000000..ac2335c
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-deep-else-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at duplicate-deep-else.cmake:[0-9]+ \(else\):
+ A duplicate ELSE command was found inside an IF block.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/if/duplicate-deep-else.cmake b/Tests/RunCMake/if/duplicate-deep-else.cmake
new file mode 100644
index 0000000..94f06de
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-deep-else.cmake
@@ -0,0 +1,7 @@
+if(0)
+else()
+ if(0)
+ else()
+ else()
+ endif()
+endif()
diff --git a/Tests/RunCMake/if/duplicate-else-after-elseif-result.txt b/Tests/RunCMake/if/duplicate-else-after-elseif-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-else-after-elseif-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt b/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt
new file mode 100644
index 0000000..ba6765c
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-else-after-elseif-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at duplicate-else-after-elseif.cmake:[0-9]+ \(else\):
+ A duplicate ELSE command was found inside an IF block.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/if/duplicate-else-after-elseif.cmake b/Tests/RunCMake/if/duplicate-else-after-elseif.cmake
new file mode 100644
index 0000000..d1d4ac1
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-else-after-elseif.cmake
@@ -0,0 +1,5 @@
+if(0)
+elseif(0)
+else()
+else()
+endif()
diff --git a/Tests/RunCMake/if/duplicate-else-result.txt b/Tests/RunCMake/if/duplicate-else-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-else-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/if/duplicate-else-stderr.txt b/Tests/RunCMake/if/duplicate-else-stderr.txt
new file mode 100644
index 0000000..e0dd01f
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-else-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at duplicate-else.cmake:[0-9]+ \(else\):
+ A duplicate ELSE command was found inside an IF block.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/if/duplicate-else.cmake b/Tests/RunCMake/if/duplicate-else.cmake
new file mode 100644
index 0000000..14a03ac
--- /dev/null
+++ b/Tests/RunCMake/if/duplicate-else.cmake
@@ -0,0 +1,4 @@
+if(0)
+else()
+else()
+endif()
diff --git a/Tests/RunCMake/if/misplaced-elseif-result.txt b/Tests/RunCMake/if/misplaced-elseif-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/if/misplaced-elseif-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/if/misplaced-elseif-stderr.txt b/Tests/RunCMake/if/misplaced-elseif-stderr.txt
new file mode 100644
index 0000000..c4b0266
--- /dev/null
+++ b/Tests/RunCMake/if/misplaced-elseif-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at misplaced-elseif.cmake:[0-9]+ \(elseif\):
+ An ELSEIF command was found after an ELSE command.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/if/misplaced-elseif.cmake b/Tests/RunCMake/if/misplaced-elseif.cmake
new file mode 100644
index 0000000..d27f24e
--- /dev/null
+++ b/Tests/RunCMake/if/misplaced-elseif.cmake
@@ -0,0 +1,4 @@
+if(0)
+else()
+elseif(1)
+endif()