diff options
author | Brad King <brad.king@kitware.com> | 2013-08-06 19:58:22 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-10-17 13:07:00 (GMT) |
commit | daa0f6f98df6e944a46a8dff13bb247cf7e301b1 (patch) | |
tree | 3125abd5ec16e69ab2019ae8c2c60c3fa5e00753 /Tests/RunCMake/Syntax | |
parent | a8c652342f0e4dcaf933ecb0ce164b44d4997ae4 (diff) | |
download | CMake-daa0f6f98df6e944a46a8dff13bb247cf7e301b1.zip CMake-daa0f6f98df6e944a46a8dff13bb247cf7e301b1.tar.gz CMake-daa0f6f98df6e944a46a8dff13bb247cf7e301b1.tar.bz2 |
Add Lua-style long brackets and long comments to CMake language
Teach the CMake language parser to recognize Lua-style "long bracket"
arguments. These start with two '[' separated by zero or more '='
characters e.g. "[[" or "[=[" or "[==[". They end with two ']'
separated by the same number of '=' as the opening bracket. There is no
nesting of brackets of the same level (number of '='). No escapes,
variable expansion, or other processing is performed on the content
between such brackets so they always represent exactly one argument.
Also teach CMake to parse and ignore "long comment" syntax. A long
comment starts with "#" immediately followed by an opening long bracket.
It ends at the matching close long bracket.
Teach the RunCMake.Syntax test to cover long bracket and long comment
cases.
Diffstat (limited to 'Tests/RunCMake/Syntax')
69 files changed, 219 insertions, 39 deletions
diff --git a/Tests/RunCMake/Syntax/.gitattributes b/Tests/RunCMake/Syntax/.gitattributes index 567121f..35a9eaf 100644 --- a/Tests/RunCMake/Syntax/.gitattributes +++ b/Tests/RunCMake/Syntax/.gitattributes @@ -1,2 +1,3 @@ CommandTabs.cmake whitespace=-tab-in-indent StringCRLF.cmake whitespace=cr-at-eol -crlf +BracketCRLF.cmake whitespace=cr-at-eol -crlf diff --git a/Tests/RunCMake/Syntax/Bracket0-stderr.txt b/Tests/RunCMake/Syntax/Bracket0-stderr.txt new file mode 100644 index 0000000..39cc2bc --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket0-stderr.txt @@ -0,0 +1 @@ +^1 \${var} \\n 4$ diff --git a/Tests/RunCMake/Syntax/Bracket0.cmake b/Tests/RunCMake/Syntax/Bracket0.cmake new file mode 100644 index 0000000..4bc0172 --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket0.cmake @@ -0,0 +1 @@ +message([[1 ${var} \n 4]]) diff --git a/Tests/RunCMake/Syntax/Bracket1-stderr.txt b/Tests/RunCMake/Syntax/Bracket1-stderr.txt new file mode 100644 index 0000000..e1e13c1 --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket1-stderr.txt @@ -0,0 +1 @@ +^1 \${var} \\n 4\]==$ diff --git a/Tests/RunCMake/Syntax/Bracket1.cmake b/Tests/RunCMake/Syntax/Bracket1.cmake new file mode 100644 index 0000000..587a575 --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket1.cmake @@ -0,0 +1,2 @@ +message([==[1 ]==] [=[ +${var} \n 4]==]=]) diff --git a/Tests/RunCMake/Syntax/Bracket2-stdout.txt b/Tests/RunCMake/Syntax/Bracket2-stdout.txt new file mode 100644 index 0000000..0f8aa2f --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket2-stdout.txt @@ -0,0 +1,2 @@ +-- Bracket Argument 1 +-- Bracket Argument 2 diff --git a/Tests/RunCMake/Syntax/Bracket2.cmake b/Tests/RunCMake/Syntax/Bracket2.cmake new file mode 100644 index 0000000..5c5feed --- /dev/null +++ b/Tests/RunCMake/Syntax/Bracket2.cmake @@ -0,0 +1,2 @@ +message(STATUS [[Bracket Argument 1]] #[[Bracket Comment 1]]) +message(STATUS #[[Bracket Comment 2]] [[Bracket Argument 2]]) diff --git a/Tests/RunCMake/Syntax/BracketBackslash-result.txt b/Tests/RunCMake/Syntax/BracketBackslash-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketBackslash-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketBackslash-stderr.txt b/Tests/RunCMake/Syntax/BracketBackslash-stderr.txt new file mode 100644 index 0000000..b746953 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketBackslash-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at BracketBackslash.cmake:1 \(message\): + a\\ + + b +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/BracketBackslash.cmake b/Tests/RunCMake/Syntax/BracketBackslash.cmake new file mode 100644 index 0000000..5478e5d --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketBackslash.cmake @@ -0,0 +1,2 @@ +message(FATAL_ERROR [==[a\ +b]==]) diff --git a/Tests/RunCMake/Syntax/BracketCRLF-stderr.txt b/Tests/RunCMake/Syntax/BracketCRLF-stderr.txt new file mode 100644 index 0000000..7aef26e --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketCRLF-stderr.txt @@ -0,0 +1 @@ +CRLF->LF worked diff --git a/Tests/RunCMake/Syntax/BracketCRLF.cmake b/Tests/RunCMake/Syntax/BracketCRLF.cmake new file mode 100644 index 0000000..bda0e17 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketCRLF.cmake @@ -0,0 +1,8 @@ +if([[
+]] STREQUAL "" AND
+[[a
+b]] STREQUAL "a\nb")
+ message("CRLF->LF worked")
+else()
+ message(FATAL_ERROR "CRLF->LF failed")
+endif()
diff --git a/Tests/RunCMake/Syntax/BracketComment0-stdout.txt b/Tests/RunCMake/Syntax/BracketComment0-stdout.txt new file mode 100644 index 0000000..c9c0be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment0-stdout.txt @@ -0,0 +1 @@ +-- The above FATAL_ERROR did not occur. diff --git a/Tests/RunCMake/Syntax/BracketComment0.cmake b/Tests/RunCMake/Syntax/BracketComment0.cmake new file mode 100644 index 0000000..0ee95de --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment0.cmake @@ -0,0 +1,5 @@ +#[=[ +#]] +message(FATAL_ERROR "This is commented out.") +#]==]=] +message(STATUS "The above FATAL_ERROR did not occur.") diff --git a/Tests/RunCMake/Syntax/BracketComment1-result.txt b/Tests/RunCMake/Syntax/BracketComment1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketComment1-stderr.txt b/Tests/RunCMake/Syntax/BracketComment1-stderr.txt new file mode 100644 index 0000000..a9373de --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment1-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BracketComment1.cmake:2 \(message\): + This is not commented out. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketComment1.cmake b/Tests/RunCMake/Syntax/BracketComment1.cmake new file mode 100644 index 0000000..2ec9d20 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment1.cmake @@ -0,0 +1,3 @@ +##[[ +message(FATAL_ERROR "This is not commented out.") +#]] diff --git a/Tests/RunCMake/Syntax/BracketComment2-result.txt b/Tests/RunCMake/Syntax/BracketComment2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketComment2-stderr.txt b/Tests/RunCMake/Syntax/BracketComment2-stderr.txt new file mode 100644 index 0000000..7e98222 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment2-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at BracketComment2.cmake:2 \(message\): + This is not commented out. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/BracketComment2.cmake b/Tests/RunCMake/Syntax/BracketComment2.cmake new file mode 100644 index 0000000..3eda32d --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment2.cmake @@ -0,0 +1,3 @@ +# [[ +message(FATAL_ERROR "This is not commented out.") +#]] diff --git a/Tests/RunCMake/Syntax/BracketComment3-stdout.txt b/Tests/RunCMake/Syntax/BracketComment3-stdout.txt new file mode 100644 index 0000000..c9c0be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment3-stdout.txt @@ -0,0 +1 @@ +-- The above FATAL_ERROR did not occur. diff --git a/Tests/RunCMake/Syntax/BracketComment3.cmake b/Tests/RunCMake/Syntax/BracketComment3.cmake new file mode 100644 index 0000000..ffd03a9 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment3.cmake @@ -0,0 +1,4 @@ +#[[Text on opening line +message(FATAL_ERROR "This is commented out.") +#]=]] +message(STATUS "The above FATAL_ERROR did not occur.") diff --git a/Tests/RunCMake/Syntax/BracketComment4-result.txt b/Tests/RunCMake/Syntax/BracketComment4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketComment4-stderr.txt b/Tests/RunCMake/Syntax/BracketComment4-stderr.txt new file mode 100644 index 0000000..8ba32c2 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment4-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: Error in cmake code at +.*/Tests/RunCMake/Syntax/BracketComment4.cmake:3: +Parse error. Expected a newline, got identifier with text "message". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + BracketComment4.cmake diff --git a/Tests/RunCMake/Syntax/BracketComment4.cmake b/Tests/RunCMake/Syntax/BracketComment4.cmake new file mode 100644 index 0000000..9d586f1 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment4.cmake @@ -0,0 +1,3 @@ +#[[ +message(FATAL_ERROR "This is commented out.") +#]] message(STATUS "This command not allowed here") diff --git a/Tests/RunCMake/Syntax/BracketComment5-stdout.txt b/Tests/RunCMake/Syntax/BracketComment5-stdout.txt new file mode 100644 index 0000000..c9c0be4 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment5-stdout.txt @@ -0,0 +1 @@ +-- The above FATAL_ERROR did not occur. diff --git a/Tests/RunCMake/Syntax/BracketComment5.cmake b/Tests/RunCMake/Syntax/BracketComment5.cmake new file mode 100644 index 0000000..bb6d9f3 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketComment5.cmake @@ -0,0 +1,6 @@ +#[[ +message(FATAL_ERROR "This is commented out.") +#]] #[[ +message(FATAL_ERROR "This is commented out.") +#]] #message(FATAL_ERROR "This is commented out.") +message(STATUS "The above FATAL_ERROR did not occur.") diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt new file mode 100644 index 0000000..afd91f9 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace0-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace0.cmake:1:27 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace0.cmake b/Tests/RunCMake/Syntax/BracketNoSpace0.cmake new file mode 100644 index 0000000..1de1450 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace0.cmake @@ -0,0 +1 @@ +message(STATUS [[bracket]]unquoted) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt new file mode 100644 index 0000000..826e511 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace1-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace1.cmake:1:24 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace1.cmake b/Tests/RunCMake/Syntax/BracketNoSpace1.cmake new file mode 100644 index 0000000..7982bf3 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace1.cmake @@ -0,0 +1 @@ +message(STATUS "string"[[bracket]]) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt new file mode 100644 index 0000000..23ecdcd --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace2-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace2.cmake:1:44 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace2.cmake b/Tests/RunCMake/Syntax/BracketNoSpace2.cmake new file mode 100644 index 0000000..f1507f3 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace2.cmake @@ -0,0 +1 @@ +message(STATUS "string"#[[bracket comment]][[bracket]]) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace3-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace3-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt new file mode 100644 index 0000000..906d6fc --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace3-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace3.cmake:1:45 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace3.cmake b/Tests/RunCMake/Syntax/BracketNoSpace3.cmake new file mode 100644 index 0000000..45dc900 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace3.cmake @@ -0,0 +1 @@ +message(STATUS "string" #[[bracket comment]][[bracket]]) diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace4-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace4-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt new file mode 100644 index 0000000..a461e93 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace4-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace4.cmake:1:44 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace4.cmake b/Tests/RunCMake/Syntax/BracketNoSpace4.cmake new file mode 100644 index 0000000..cb4ddbe --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace4.cmake @@ -0,0 +1 @@ +message(STATUS "string"#[[bracket comment]]"string") diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5-result.txt b/Tests/RunCMake/Syntax/BracketNoSpace5-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace5-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt new file mode 100644 index 0000000..ff8bf1c --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace5-stderr.txt @@ -0,0 +1,6 @@ +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/BracketNoSpace5.cmake:1:45 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/BracketNoSpace5.cmake b/Tests/RunCMake/Syntax/BracketNoSpace5.cmake new file mode 100644 index 0000000..c684523 --- /dev/null +++ b/Tests/RunCMake/Syntax/BracketNoSpace5.cmake @@ -0,0 +1 @@ +message(STATUS "string" #[[bracket comment]]"string") diff --git a/Tests/RunCMake/Syntax/BracketWarn-stderr.txt b/Tests/RunCMake/Syntax/BracketWarn-stderr.txt deleted file mode 100644 index 4a9cca6..0000000 --- a/Tests/RunCMake/Syntax/BracketWarn-stderr.txt +++ /dev/null @@ -1,35 +0,0 @@ -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): - Syntax Warning in cmake code at - - .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:16 - - A future version of CMake may treat unquoted argument: - - \[\[ - - as an opening long bracket. Double-quote the argument. -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): - Syntax Warning in cmake code at - - .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:19 - - A future version of CMake may treat unquoted argument: - - \[=\[ - - as an opening long bracket. Double-quote the argument. -This warning is for project developers. Use -Wno-dev to suppress it. - -CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): - Syntax Warning in cmake code at - - .*/Tests/RunCMake/Syntax/BracketWarn.cmake:1:27 - - A future version of CMake may treat unquoted argument: - - \[==\[x - - as an opening long bracket. Double-quote the argument. -This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Syntax/BracketWarn-stdout.txt b/Tests/RunCMake/Syntax/BracketWarn-stdout.txt deleted file mode 100644 index 01b2caa..0000000 --- a/Tests/RunCMake/Syntax/BracketWarn-stdout.txt +++ /dev/null @@ -1 +0,0 @@ --- \[\[\[=\[\[=x\[==\[x diff --git a/Tests/RunCMake/Syntax/BracketWarn.cmake b/Tests/RunCMake/Syntax/BracketWarn.cmake deleted file mode 100644 index 8f33946..0000000 --- a/Tests/RunCMake/Syntax/BracketWarn.cmake +++ /dev/null @@ -1 +0,0 @@ -message(STATUS [[ [=[ [=x [==[x) diff --git a/Tests/RunCMake/Syntax/CommandError2-result.txt b/Tests/RunCMake/Syntax/CommandError2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CommandError2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CommandError2-stderr.txt b/Tests/RunCMake/Syntax/CommandError2-stderr.txt new file mode 100644 index 0000000..f4dfc77 --- /dev/null +++ b/Tests/RunCMake/Syntax/CommandError2-stderr.txt @@ -0,0 +1,7 @@ +CMake Error: Error in cmake code at +.*/Tests/RunCMake/Syntax/CommandError2.cmake:1: +Parse error. Expected a command name, got bracket argument with text "oops-not-a-comment". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + CommandError2.cmake diff --git a/Tests/RunCMake/Syntax/CommandError2.cmake b/Tests/RunCMake/Syntax/CommandError2.cmake new file mode 100644 index 0000000..a269682 --- /dev/null +++ b/Tests/RunCMake/Syntax/CommandError2.cmake @@ -0,0 +1 @@ +message("Example Message") [[oops-not-a-comment]] diff --git a/Tests/RunCMake/Syntax/ParenNoSpace0-stdout.txt b/Tests/RunCMake/Syntax/ParenNoSpace0-stdout.txt new file mode 100644 index 0000000..5c4076f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace0-stdout.txt @@ -0,0 +1,3 @@ +-- \(unquoted\) +-- \(quoted\) +-- \(bracket\) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace0.cmake b/Tests/RunCMake/Syntax/ParenNoSpace0.cmake new file mode 100644 index 0000000..175fe4a --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace0.cmake @@ -0,0 +1,3 @@ +message(STATUS (unquoted)) +message(STATUS ("quoted")) +message(STATUS ([[bracket]])) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1-result.txt b/Tests/RunCMake/Syntax/ParenNoSpace1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt new file mode 100644 index 0000000..64ef8b1 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace1-stderr.txt @@ -0,0 +1,22 @@ +CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): + Syntax Warning in cmake code at + + .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:1:26 + + Argument not separated from preceding token by whitespace. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at CMakeLists.txt:3 \(include\): + Syntax Warning in cmake code at + + .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:2:26 + + Argument not separated from preceding token by whitespace. +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Error at CMakeLists.txt:3 \(include\): + Syntax Error in cmake code at + + .*/Tests/RunCMake/Syntax/ParenNoSpace1.cmake:3:29 + + Argument not separated from preceding token by whitespace. diff --git a/Tests/RunCMake/Syntax/ParenNoSpace1.cmake b/Tests/RunCMake/Syntax/ParenNoSpace1.cmake new file mode 100644 index 0000000..550339a --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenNoSpace1.cmake @@ -0,0 +1,3 @@ +message(STATUS (unquoted)unquoted) +message(STATUS ("quoted")"quoted") +message(STATUS ([[bracket]])[[bracket]]) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace-stderr.txt b/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt index 10f3293..10f3293 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace-stderr.txt +++ b/Tests/RunCMake/Syntax/ParenNoSpace2-stderr.txt diff --git a/Tests/RunCMake/Syntax/ParenNoSpace-stdout.txt b/Tests/RunCMake/Syntax/ParenNoSpace2-stdout.txt index 72addd7..0e657b9 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace-stdout.txt +++ b/Tests/RunCMake/Syntax/ParenNoSpace2-stdout.txt @@ -1,2 +1,3 @@ -- unquoted\(unquoted\) -- quoted\(quoted\) +-- bracket\(bracket\) diff --git a/Tests/RunCMake/Syntax/ParenNoSpace.cmake b/Tests/RunCMake/Syntax/ParenNoSpace2.cmake index c690d96..c46a887 100644 --- a/Tests/RunCMake/Syntax/ParenNoSpace.cmake +++ b/Tests/RunCMake/Syntax/ParenNoSpace2.cmake @@ -1,2 +1,3 @@ message(STATUS unquoted(unquoted)) message(STATUS "quoted"("quoted")) +message(STATUS [[bracket]]([[bracket]])) diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index 1399d8b..f5e0d11 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -11,6 +11,7 @@ run_cmake(CommandNewlines) run_cmake(CommandComments) run_cmake(CommandError0) run_cmake(CommandError1) +run_cmake(CommandError2) run_cmake(String0) run_cmake(String1) run_cmake(StringCRLF) @@ -18,8 +19,29 @@ run_cmake(StringNoSpace) run_cmake(OneLetter) run_cmake(Unquoted0) run_cmake(Unquoted1) -run_cmake(ParenNoSpace) +run_cmake(Bracket0) +run_cmake(Bracket1) +run_cmake(Bracket2) +run_cmake(BracketBackslash) +run_cmake(BracketCRLF) +run_cmake(BracketComment0) +run_cmake(BracketComment1) +run_cmake(BracketComment2) +run_cmake(BracketComment3) +run_cmake(BracketComment4) +run_cmake(BracketComment5) +run_cmake(BracketNoSpace0) +run_cmake(BracketNoSpace1) +run_cmake(BracketNoSpace2) +run_cmake(BracketNoSpace3) +run_cmake(BracketNoSpace4) +run_cmake(BracketNoSpace5) +run_cmake(ParenNoSpace0) +run_cmake(ParenNoSpace1) +run_cmake(ParenNoSpace2) run_cmake(UnterminatedCall1) run_cmake(UnterminatedCall2) run_cmake(UnterminatedString) -run_cmake(BracketWarn) +run_cmake(UnterminatedBracket0) +run_cmake(UnterminatedBracket1) +run_cmake(UnterminatedBracketComment) diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket0-result.txt b/Tests/RunCMake/Syntax/UnterminatedBracket0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket0-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBracket0-stderr.txt new file mode 100644 index 0000000..3559c18 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket0-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: Error in cmake code at +.*/Syntax/UnterminatedBracket0.cmake:2: +Parse error. Function missing ending "\)". Instead found unterminated bracket with text "\) +". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + UnterminatedBracket0.cmake$ diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket0.cmake b/Tests/RunCMake/Syntax/UnterminatedBracket0.cmake new file mode 100644 index 0000000..98cd906 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket0.cmake @@ -0,0 +1 @@ +set(var [[) diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket1-result.txt b/Tests/RunCMake/Syntax/UnterminatedBracket1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBracket1-stderr.txt new file mode 100644 index 0000000..55d458b --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket1-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: Error in cmake code at +.*/Syntax/UnterminatedBracket1.cmake:2: +Parse error. Function missing ending "\)". Instead found unterminated bracket with text "\]\]\) +". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + UnterminatedBracket1.cmake$ diff --git a/Tests/RunCMake/Syntax/UnterminatedBracket1.cmake b/Tests/RunCMake/Syntax/UnterminatedBracket1.cmake new file mode 100644 index 0000000..706f7a3 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracket1.cmake @@ -0,0 +1 @@ +set(var [=[]]) diff --git a/Tests/RunCMake/Syntax/UnterminatedBracketComment-result.txt b/Tests/RunCMake/Syntax/UnterminatedBracketComment-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracketComment-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBracketComment-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBracketComment-stderr.txt new file mode 100644 index 0000000..0a799eb --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracketComment-stderr.txt @@ -0,0 +1,8 @@ +CMake Error: Error in cmake code at +.*/Syntax/UnterminatedBracketComment.cmake:1: +Parse error. Expected a command name, got unterminated bracket with text "#\]\] +". +CMake Error at CMakeLists.txt:3 \(include\): + include could not find load file: + + UnterminatedBracketComment.cmake diff --git a/Tests/RunCMake/Syntax/UnterminatedBracketComment.cmake b/Tests/RunCMake/Syntax/UnterminatedBracketComment.cmake new file mode 100644 index 0000000..ad71f3c --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBracketComment.cmake @@ -0,0 +1,2 @@ +#[=[ +#]] |