mirror of
https://github.com/reactos/CMake.git
synced 2024-11-25 04:29:52 +00:00
Add RunCMake.Syntax test to cover argument parsing
Test basic unquoted and quoted argument parsing cases including failure on an unterminated string and an unterminated command invocation. Also cover arguments not separated by any spaces, which is accidentally allowed by the current parser.
This commit is contained in:
parent
87e0e6e497
commit
f3155cd62a
@ -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)
|
||||
|
3
Tests/RunCMake/Syntax/CMakeLists.txt
Normal file
3
Tests/RunCMake/Syntax/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 2.8.9)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
9
Tests/RunCMake/Syntax/RunCMakeTest.cmake
Normal file
9
Tests/RunCMake/Syntax/RunCMakeTest.cmake
Normal file
@ -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)
|
1
Tests/RunCMake/Syntax/String0-stderr.txt
Normal file
1
Tests/RunCMake/Syntax/String0-stderr.txt
Normal file
@ -0,0 +1 @@
|
||||
^1 2;3 4$
|
2
Tests/RunCMake/Syntax/String0.cmake
Normal file
2
Tests/RunCMake/Syntax/String0.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(var 2 3)
|
||||
message("1 ${var} 4")
|
3
Tests/RunCMake/Syntax/String1-stderr.txt
Normal file
3
Tests/RunCMake/Syntax/String1-stderr.txt
Normal file
@ -0,0 +1,3 @@
|
||||
^
|
||||
1 \${var} 4
|
||||
$
|
3
Tests/RunCMake/Syntax/String1.cmake
Normal file
3
Tests/RunCMake/Syntax/String1.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
message("
|
||||
1 \${var} 4
|
||||
")
|
3
Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
Normal file
3
Tests/RunCMake/Syntax/StringNoSpace-stderr.txt
Normal file
@ -0,0 +1,3 @@
|
||||
^\[1 \${var} \\n 4\]
|
||||
\[x\]
|
||||
\[y\]$
|
4
Tests/RunCMake/Syntax/StringNoSpace.cmake
Normal file
4
Tests/RunCMake/Syntax/StringNoSpace.cmake
Normal file
@ -0,0 +1,4 @@
|
||||
# Quoted arguments may be immediately followed by another argument.
|
||||
foreach(x "1 \${var} \\n 4""x"y)
|
||||
message("[${x}]")
|
||||
endforeach()
|
1
Tests/RunCMake/Syntax/Unquoted0-stderr.txt
Normal file
1
Tests/RunCMake/Syntax/Unquoted0-stderr.txt
Normal file
@ -0,0 +1 @@
|
||||
^1234$
|
2
Tests/RunCMake/Syntax/Unquoted0.cmake
Normal file
2
Tests/RunCMake/Syntax/Unquoted0.cmake
Normal file
@ -0,0 +1,2 @@
|
||||
set(var 2 3)
|
||||
message(1 ${var} 4)
|
1
Tests/RunCMake/Syntax/Unquoted1-stderr.txt
Normal file
1
Tests/RunCMake/Syntax/Unquoted1-stderr.txt
Normal file
@ -0,0 +1 @@
|
||||
^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]$
|
1
Tests/RunCMake/Syntax/Unquoted1.cmake
Normal file
1
Tests/RunCMake/Syntax/Unquoted1.cmake
Normal file
@ -0,0 +1 @@
|
||||
message([] [=] [$ $(MV) -DSTR=" [=" [;])
|
1
Tests/RunCMake/Syntax/UnterminatedCall1-result.txt
Normal file
1
Tests/RunCMake/Syntax/UnterminatedCall1-result.txt
Normal file
@ -0,0 +1 @@
|
||||
1
|
7
Tests/RunCMake/Syntax/UnterminatedCall1-stderr.txt
Normal file
7
Tests/RunCMake/Syntax/UnterminatedCall1-stderr.txt
Normal file
@ -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
|
1
Tests/RunCMake/Syntax/UnterminatedCall1.cmake
Normal file
1
Tests/RunCMake/Syntax/UnterminatedCall1.cmake
Normal file
@ -0,0 +1 @@
|
||||
message(
|
1
Tests/RunCMake/Syntax/UnterminatedString-result.txt
Normal file
1
Tests/RunCMake/Syntax/UnterminatedString-result.txt
Normal file
@ -0,0 +1 @@
|
||||
1
|
8
Tests/RunCMake/Syntax/UnterminatedString-stderr.txt
Normal file
8
Tests/RunCMake/Syntax/UnterminatedString-stderr.txt
Normal file
@ -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$
|
1
Tests/RunCMake/Syntax/UnterminatedString.cmake
Normal file
1
Tests/RunCMake/Syntax/UnterminatedString.cmake
Normal file
@ -0,0 +1 @@
|
||||
set(var ")
|
Loading…
Reference in New Issue
Block a user