diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt index 1b9c17bd7..e45aba378 100644 --- a/Tests/RunCMake/CMakeLists.txt +++ b/Tests/RunCMake/CMakeLists.txt @@ -85,6 +85,7 @@ if(NOT WIN32) endif() endif() add_RunCMake_test(CompatibleInterface) +add_RunCMake_test(Syntax) add_RunCMake_test(add_dependencies) add_RunCMake_test(build_command) diff --git a/Tests/RunCMake/Syntax/CMakeLists.txt b/Tests/RunCMake/Syntax/CMakeLists.txt new file mode 100644 index 000000000..618473aaa --- /dev/null +++ b/Tests/RunCMake/Syntax/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 2.8.9) +project(${RunCMake_TEST} NONE) +include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake new file mode 100644 index 000000000..4a3d462b7 --- /dev/null +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -0,0 +1,9 @@ +include(RunCMake) + +run_cmake(String0) +run_cmake(String1) +run_cmake(StringNoSpace) +run_cmake(Unquoted0) +run_cmake(Unquoted1) +run_cmake(UnterminatedCall1) +run_cmake(UnterminatedString) diff --git a/Tests/RunCMake/Syntax/String0-stderr.txt b/Tests/RunCMake/Syntax/String0-stderr.txt new file mode 100644 index 000000000..8eea0695c --- /dev/null +++ b/Tests/RunCMake/Syntax/String0-stderr.txt @@ -0,0 +1 @@ +^1 2;3 4$ diff --git a/Tests/RunCMake/Syntax/String0.cmake b/Tests/RunCMake/Syntax/String0.cmake new file mode 100644 index 000000000..95281d73f --- /dev/null +++ b/Tests/RunCMake/Syntax/String0.cmake @@ -0,0 +1,2 @@ +set(var 2 3) +message("1 ${var} 4") diff --git a/Tests/RunCMake/Syntax/String1-stderr.txt b/Tests/RunCMake/Syntax/String1-stderr.txt new file mode 100644 index 000000000..07e98dae0 --- /dev/null +++ b/Tests/RunCMake/Syntax/String1-stderr.txt @@ -0,0 +1,3 @@ +^ + 1 \${var} 4 + $ diff --git a/Tests/RunCMake/Syntax/String1.cmake b/Tests/RunCMake/Syntax/String1.cmake new file mode 100644 index 000000000..a94c9ffdb --- /dev/null +++ b/Tests/RunCMake/Syntax/String1.cmake @@ -0,0 +1,3 @@ +message(" + 1 \${var} 4 + ") diff --git a/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt new file mode 100644 index 000000000..2d111aaa8 --- /dev/null +++ b/Tests/RunCMake/Syntax/StringNoSpace-stderr.txt @@ -0,0 +1,3 @@ +^\[1 \${var} \\n 4\] +\[x\] +\[y\]$ diff --git a/Tests/RunCMake/Syntax/StringNoSpace.cmake b/Tests/RunCMake/Syntax/StringNoSpace.cmake new file mode 100644 index 000000000..76f22db9a --- /dev/null +++ b/Tests/RunCMake/Syntax/StringNoSpace.cmake @@ -0,0 +1,4 @@ +# Quoted arguments may be immediately followed by another argument. +foreach(x "1 \${var} \\n 4""x"y) + message("[${x}]") +endforeach() diff --git a/Tests/RunCMake/Syntax/Unquoted0-stderr.txt b/Tests/RunCMake/Syntax/Unquoted0-stderr.txt new file mode 100644 index 000000000..ea68ebfa9 --- /dev/null +++ b/Tests/RunCMake/Syntax/Unquoted0-stderr.txt @@ -0,0 +1 @@ +^1234$ diff --git a/Tests/RunCMake/Syntax/Unquoted0.cmake b/Tests/RunCMake/Syntax/Unquoted0.cmake new file mode 100644 index 000000000..c5314c9f0 --- /dev/null +++ b/Tests/RunCMake/Syntax/Unquoted0.cmake @@ -0,0 +1,2 @@ +set(var 2 3) +message(1 ${var} 4) diff --git a/Tests/RunCMake/Syntax/Unquoted1-stderr.txt b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt new file mode 100644 index 000000000..ff8194a6f --- /dev/null +++ b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt @@ -0,0 +1 @@ +^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]$ diff --git a/Tests/RunCMake/Syntax/Unquoted1.cmake b/Tests/RunCMake/Syntax/Unquoted1.cmake new file mode 100644 index 000000000..0344fbd59 --- /dev/null +++ b/Tests/RunCMake/Syntax/Unquoted1.cmake @@ -0,0 +1 @@ +message([] [=] [$ $(MV) -DSTR=" [=" [;]) diff --git a/Tests/RunCMake/Syntax/UnterminatedCall1-result.txt b/Tests/RunCMake/Syntax/UnterminatedCall1-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedCall1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedCall1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedCall1-stderr.txt new file mode 100644 index 000000000..281ce0da8 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedCall1-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: Error in cmake code at +.*/Syntax/UnterminatedCall1.cmake:2: +Parse error. Function missing ending "\)". End of file reached. +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + UnterminatedCall1.cmake diff --git a/Tests/RunCMake/Syntax/UnterminatedCall1.cmake b/Tests/RunCMake/Syntax/UnterminatedCall1.cmake new file mode 100644 index 000000000..1166109c9 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedCall1.cmake @@ -0,0 +1 @@ +message( diff --git a/Tests/RunCMake/Syntax/UnterminatedString-result.txt b/Tests/RunCMake/Syntax/UnterminatedString-result.txt new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedString-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedString-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedString-stderr.txt new file mode 100644 index 000000000..d9250328d --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedString-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: Error in cmake code at +.*/Syntax/UnterminatedString.cmake:2: +Parse error. Function missing ending "\)". Instead found unterminated string with text "\) +". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + UnterminatedString.cmake$ diff --git a/Tests/RunCMake/Syntax/UnterminatedString.cmake b/Tests/RunCMake/Syntax/UnterminatedString.cmake new file mode 100644 index 000000000..721ae7510 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedString.cmake @@ -0,0 +1 @@ +set(var ")