Commit f3155cd6 authored by Brad King's avatar Brad King
Browse files

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.
parent 87e0e6e4
......@@ -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)
......
cmake_minimum_required(VERSION 2.8.9)
project(${RunCMake_TEST} NONE)
include(${RunCMake_TEST}.cmake)
include(RunCMake)
run_cmake(String0)
run_cmake(String1)
run_cmake(StringNoSpace)
run_cmake(Unquoted0)
run_cmake(Unquoted1)
run_cmake(UnterminatedCall1)
run_cmake(UnterminatedString)
set(var 2 3)
message("1 ${var} 4")
^\[1 \${var} \\n 4\]
\[x\]
\[y\]$
# Quoted arguments may be immediately followed by another argument.
foreach(x "1 \${var} \\n 4""x"y)
message("[${x}]")
endforeach()
set(var 2 3)
message(1 ${var} 4)
^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]$
message([] [=] [$ $(MV) -DSTR=" [=" [;])
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
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$
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment