diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2014-02-18 19:47:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-05-08 17:24:49 (GMT) |
commit | 411f77d14f0cea36aeaf04b01d3fdf2ea7ec2173 (patch) | |
tree | 45198448818b927c305d62e2653281a8c60f56b6 /Tests/RunCMake/Syntax | |
parent | bc3856586388a610ef3d06d51c212a9ed25856c4 (diff) | |
download | CMake-411f77d14f0cea36aeaf04b01d3fdf2ea7ec2173.zip CMake-411f77d14f0cea36aeaf04b01d3fdf2ea7ec2173.tar.gz CMake-411f77d14f0cea36aeaf04b01d3fdf2ea7ec2173.tar.bz2 |
EVIS: Add tests for syntax corner cases and CMP0053
Include tests for:
- @ expansion during normal execution
- various characters in variable names for comparison between the new
and the old parser
- corner cases in the parsers
- correct messages when behavior is different
Diffstat (limited to 'Tests/RunCMake/Syntax')
107 files changed, 692 insertions, 1 deletions
diff --git a/Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt new file mode 100644 index 0000000..e3e5332 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-NEW-stderr.txt @@ -0,0 +1 @@ +^-->\${right}<--$ diff --git a/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake b/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake new file mode 100644 index 0000000..40dbe46 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-NEW.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0053 NEW) + +set(right "wrong") +set(var "\${right}") +# Not expanded here with the new policy. +set(ref "@var@") + +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt new file mode 100644 index 0000000..acfa30a --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-OLD-stderr.txt @@ -0,0 +1 @@ +^-->wrong<--$ diff --git a/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake b/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake new file mode 100644 index 0000000..666f107 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-OLD.cmake @@ -0,0 +1,9 @@ +cmake_policy(SET CMP0053 OLD) + +set(right "wrong") +set(var "\${right}") +# Expanded here with the old policy. +set(ref "@var@") + +string(CONFIGURE "${ref}" output) +message("-->${output}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt new file mode 100644 index 0000000..ec37021 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines-stderr.txt @@ -0,0 +1,27 @@ +^CMake Warning \(dev\) at CMP0053-At-WARN-newlines.cmake:4 \(set\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + ' + @var@ + ' + + the old evaluation rules produce: + + ' + \${right} + ' + + but the new evaluation rules produce: + + ' + @var@ + ' + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake new file mode 100644 index 0000000..c493505 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-WARN-newlines.cmake @@ -0,0 +1,6 @@ +set(right "wrong") +set(var "\${right}") +# Expanded here with the old policy. +set(ref " +@var@ +") diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt new file mode 100644 index 0000000..697b7b3 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-WARN-stderr.txt @@ -0,0 +1,21 @@ +^CMake Warning \(dev\) at CMP0053-At-WARN.cmake:4 \(set\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + '@var@' + + the old evaluation rules produce: + + '\${right}' + + but the new evaluation rules produce: + + '@var@' + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it.$ diff --git a/Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake b/Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake new file mode 100644 index 0000000..19c7f53 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-At-WARN.cmake @@ -0,0 +1,4 @@ +set(right "wrong") +set(var "\${right}") +# Expanded here with the old policy. +set(ref "@var@") diff --git a/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt new file mode 100644 index 0000000..09c7e7c --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NUL-stderr.txt @@ -0,0 +1,56 @@ +^CMake Warning \(dev\) at CMP0053-NUL.cmake:1 \(set\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + '\\0' + + the old evaluation rules produce: + + '' + + but the new evaluation rules produce an error: + + Syntax error in cmake code at + .*/Tests/RunCMake/Syntax/CMP0053-NUL.cmake:1 + when parsing string + \\0 + Invalid character escape '\\0'. + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +CMake Warning \(dev\) at CMP0053-NUL.cmake:2 \(set\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + '\\0' + + the old evaluation rules produce: + + '' + + but the new evaluation rules produce an error: + + Syntax error in cmake code at + .*/Tests/RunCMake/Syntax/CMP0053-NUL.cmake:2 + when parsing string + \\0 + Invalid character escape '\\0'. + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +--><-- +--><-- +--><-- +--><--$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NUL.cmake b/Tests/RunCMake/Syntax/CMP0053-NUL.cmake new file mode 100644 index 0000000..9ae0906 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NUL.cmake @@ -0,0 +1,6 @@ +set(qnul "\0") +set(nul \0) +message(-->${nul}<--) +message(-->${qnul}<--) +message("-->${nul}<--") +message("-->${qnul}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt new file mode 100644 index 0000000..9575778 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0053-NameWithCarriageReturn.cmake:2 \(message\): + message called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake new file mode 100644 index 0000000..b8a403d --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturn.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var\rwith\rcarriagereturn}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake new file mode 100644 index 0000000..bb0d93f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithCarriageReturnQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var\rwith\rcarriagereturn}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt new file mode 100644 index 0000000..df67d37 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0053-NameWithEscapedSpaces.cmake:2 \(message\): + message called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake new file mode 100644 index 0000000..805b2ca --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpaces.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var\ with\ escaped\ space}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake new file mode 100644 index 0000000..58d8e8f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedSpacesQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var\ with\ escaped\ space}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt new file mode 100644 index 0000000..059044f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0053-NameWithEscapedTabs.cmake:2 \(message\): + message called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake new file mode 100644 index 0000000..214ab5d --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabs.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var\ with\ escaped\ tab}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake new file mode 100644 index 0000000..aa5123f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithEscapedTabsQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var\ with\ escaped\ tab}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt new file mode 100644 index 0000000..41f86e6 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline-stderr.txt @@ -0,0 +1,4 @@ +^CMake Error at CMP0053-NameWithNewline.cmake:2 \(message\): + message called with incorrect number of arguments +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake new file mode 100644 index 0000000..45b532e --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithNewline.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var\nwith\nnewline}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake new file mode 100644 index 0000000..6fe568d --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithNewlineQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var\nwith\nnewline}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt new file mode 100644 index 0000000..95e8684 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at CMP0053-NameWithSpaces.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake:2 + + when parsing string + + \${var + + There is an unterminated variable reference. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake new file mode 100644 index 0000000..dae7d25 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpaces.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var with space}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt new file mode 100644 index 0000000..c4f3cfe --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at CMP0053-NameWithSpacesQuoted.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake:2 + + when parsing string + + \${var with space} + + Invalid character \(' '\) in a variable name: 'var' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake new file mode 100644 index 0000000..e252cff --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithSpacesQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var with space}") diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt new file mode 100644 index 0000000..b1678b3 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at CMP0053-NameWithTabs.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake:2 + + when parsing string + + \${var + + There is an unterminated variable reference. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake new file mode 100644 index 0000000..45e3045 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabs.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message(${var with tab}) diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt new file mode 100644 index 0000000..78adb5e --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at CMP0053-NameWithTabsQuoted.cmake:2 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake:2 + + when parsing string + + \${var with tab} + + Invalid character \(' '\) in a variable name: 'var' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake new file mode 100644 index 0000000..498675f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-NameWithTabsQuoted.cmake @@ -0,0 +1,2 @@ +cmake_policy(SET CMP0053 NEW) +message("${var with tab}") diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt new file mode 100644 index 0000000..7020c7e --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-ParenInENV-stderr.txt @@ -0,0 +1 @@ +-->value<-- diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake b/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake new file mode 100644 index 0000000..b5cdf0f --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-ParenInENV.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0053 NEW) +set("ENV{e(x)}" value) +message(-->$ENV{e\(x\)}<--) diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt new file mode 100644 index 0000000..7020c7e --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV-stderr.txt @@ -0,0 +1 @@ +-->value<-- diff --git a/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake new file mode 100644 index 0000000..5559d4b --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-ParenInQuotedENV.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0053 NEW) +set("ENV{e(x)}" value) +message("-->$ENV{e\(x\)}<--") diff --git a/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt b/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt new file mode 100644 index 0000000..c706939 --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-WARN-stderr.txt @@ -0,0 +1,28 @@ +^CMake Warning \(dev\) at CMP0053-WARN.cmake:2 \(message\): + Policy CMP0053 is not set: Simplify variable reference and escape sequence + evaluation. Run "cmake --help-policy CMP0053" for policy details. Use the + cmake_policy command to set the policy and suppress this warning. + + For input: + + '\\' + + the old evaluation rules produce: + + '\\' + + but the new evaluation rules produce an error: + + Syntax error in cmake code at + .*/Tests/RunCMake/Syntax/CMP0053-WARN.cmake:2 + when parsing string + \\ + Invalid character escape '\\' \(at end of input\). + + Using the old result for compatibility since the policy is not set. +Call Stack \(most recent call first\): + CMP0053-WARN.cmake:5 \(escape\) + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. + +\\$ diff --git a/Tests/RunCMake/Syntax/CMP0053-WARN.cmake b/Tests/RunCMake/Syntax/CMP0053-WARN.cmake new file mode 100644 index 0000000..6e8b07b --- /dev/null +++ b/Tests/RunCMake/Syntax/CMP0053-WARN.cmake @@ -0,0 +1,5 @@ +macro (escape str) + message("${str}") +endmacro () + +escape("\\") diff --git a/Tests/RunCMake/Syntax/CMakeLists.txt b/Tests/RunCMake/Syntax/CMakeLists.txt index 618473a..4b3de84 100644 --- a/Tests/RunCMake/Syntax/CMakeLists.txt +++ b/Tests/RunCMake/Syntax/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 2.8.12) project(${RunCMake_TEST} NONE) include(${RunCMake_TEST}.cmake) diff --git a/Tests/RunCMake/Syntax/Escape2-result.txt b/Tests/RunCMake/Syntax/Escape2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/Escape2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/Escape2-stderr.txt b/Tests/RunCMake/Syntax/Escape2-stderr.txt new file mode 100644 index 0000000..cc3bdf0 --- /dev/null +++ b/Tests/RunCMake/Syntax/Escape2-stderr.txt @@ -0,0 +1,13 @@ +CMake Error at Escape2.cmake:4 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/Escape2.cmake:4 + + when parsing string + + \\ + + Invalid character escape '\\' \(at end of input\). +Call Stack \(most recent call first\): + Escape2.cmake:7 \(escape\) + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/Escape2.cmake b/Tests/RunCMake/Syntax/Escape2.cmake new file mode 100644 index 0000000..078a822 --- /dev/null +++ b/Tests/RunCMake/Syntax/Escape2.cmake @@ -0,0 +1,7 @@ +cmake_policy(SET CMP0053 NEW) + +macro (escape str) + message("${str}") +endmacro () + +escape("\\") diff --git a/Tests/RunCMake/Syntax/EscapeChar-char-result.txt b/Tests/RunCMake/Syntax/EscapeChar-char-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeChar-char-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in b/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in new file mode 100644 index 0000000..d1d908c --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeChar-char-stderr.txt.in @@ -0,0 +1,12 @@ +CMake Error at EscapeChar-@char@-@testnum@.cmake:3 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/EscapeChar-@char@-@testnum@.cmake:3 + + when parsing string + + -->\\@char@<-- + + Invalid character escape '\\@char@'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in b/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in new file mode 100644 index 0000000..6f265e5 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeChar-char.cmake.in @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0053 NEW) + +message("-->\@char@<--") diff --git a/Tests/RunCMake/Syntax/EscapeCharsAllowed-stderr.txt b/Tests/RunCMake/Syntax/EscapeCharsAllowed-stderr.txt new file mode 100644 index 0000000..e658de7 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeCharsAllowed-stderr.txt @@ -0,0 +1,12 @@ +^-->semicolon<-- +-->dollar<-- +-->brace<-- +-->bracket<-- +-->newline<-- +-->octothorpe<-- +-->splat<-- +-->caret<-- +-->paren<-- +-->dquote<-- +-->top-levelsemicolon<-- +-->top-level;escaped;semicolon<--$ diff --git a/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake b/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake new file mode 100644 index 0000000..e9c568d --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeCharsAllowed.cmake @@ -0,0 +1,26 @@ +cmake_policy(SET CMP0053 NEW) + +set("semicolon;in;name" semicolon) +set("dollar$in$name" dollar) +set("brace{in}name" brace) +set("bracket[in]name" bracket) +set("newline\nin\nname" newline) +set("octothorpe\#in\#name" octothorpe) +set("splat\@in\@name" splat) +set("caret\^in\^name" caret) +set("paren\(in\)name" paren) +set("dquote\"in\"name" dquote) + +message("-->${semicolon\;in\;name}<--") +message("-->${dollar\$in\$name}<--") +message("-->${brace\{in\}name}<--") +message("-->${bracket\[in\]name}<--") +message("-->${newline\nin\nname}<--") +message("-->${octothorpe\#in\#name}<--") +message("-->${splat\@in\@name}<--") +message("-->${caret\^in\^name}<--") +message("-->${paren\(in\)name}<--") +message("-->${dquote\"in\"name}<--") + +message(-->top-level;semicolon<--) +message(-->top-level\;escaped\;semicolon<--) diff --git a/Tests/RunCMake/Syntax/EscapeCharsDisallowed.cmake b/Tests/RunCMake/Syntax/EscapeCharsDisallowed.cmake new file mode 100644 index 0000000..eef01a0 --- /dev/null +++ b/Tests/RunCMake/Syntax/EscapeCharsDisallowed.cmake @@ -0,0 +1,42 @@ +set(disallowed_chars + a b c d e f g h i j l m o p q s u v w x y z + A B C D E F G H I J L M N O P Q R S T U V W X Y Z + 0 1 2 3 4 5 6 6 7 8 9) +set(testnum 0) + +configure_file( + "${RunCMake_SOURCE_DIR}/CMakeLists.txt" + "${RunCMake_BINARY_DIR}/CMakeLists.txt" + COPYONLY) + +foreach (char IN LISTS disallowed_chars) + configure_file( + "${RunCMake_SOURCE_DIR}/EscapeChar-char.cmake.in" + "${RunCMake_BINARY_DIR}/EscapeChar-${char}-${testnum}.cmake" + @ONLY) + configure_file( + "${RunCMake_SOURCE_DIR}/EscapeChar-char-stderr.txt.in" + "${RunCMake_BINARY_DIR}/EscapeChar-${char}-${testnum}-stderr.txt" + @ONLY) + configure_file( + "${RunCMake_SOURCE_DIR}/EscapeChar-char-result.txt" + "${RunCMake_BINARY_DIR}/EscapeChar-${char}-${testnum}-result.txt" + COPYONLY) + + math(EXPR testnum "${testnum} + 1") +endforeach () + +function (run_tests) + set(GENERATED_RUNCMAKE_TESTS TRUE) + # Find the tests in the binary directory. + set(RunCMake_SOURCE_DIR "${RunCMake_BINARY_DIR}") + + set(testnum 0) + foreach (char IN LISTS disallowed_chars) + run_cmake("EscapeChar-${char}-${testnum}") + + math(EXPR testnum "${testnum} + 1") + endforeach () +endfunction () + +run_tests() diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn-result.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturn-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt new file mode 100644 index 0000000..7448b59 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithCarriageReturn.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake:1 + + when parsing string + + \${var\\rwith\\rcarriagereturn} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake b/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake new file mode 100644 index 0000000..614f554 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturn.cmake @@ -0,0 +1 @@ +message(${var\rwith\rcarriagereturn}) diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt new file mode 100644 index 0000000..f5e03ed --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithCarriageReturnQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake:1 + + when parsing string + + \${var\\rwith\\rcarriagereturn} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake new file mode 100644 index 0000000..bac69e4 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithCarriageReturnQuoted.cmake @@ -0,0 +1 @@ +message("${var\rwith\rcarriagereturn}") diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-result.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt new file mode 100644 index 0000000..fa16a8a --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithEscapedSpaces.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake:1 + + when parsing string + + \${var\\ with\\ escaped\\ space} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake b/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake new file mode 100644 index 0000000..6cb8401 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpaces.cmake @@ -0,0 +1 @@ +message(${var\ with\ escaped\ space}) diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt new file mode 100644 index 0000000..07cbf24 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithEscapedSpacesQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake:1 + + when parsing string + + \${var\\ with\\ escaped\\ space} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake new file mode 100644 index 0000000..2bd4bfd --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedSpacesQuoted.cmake @@ -0,0 +1 @@ +message("${var\ with\ escaped\ space}") diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabs-result.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt new file mode 100644 index 0000000..d7fc38a --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabs-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithEscapedTabs.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake:1 + + when parsing string + + \${var\\ with\\ escaped\\ tab} + + Invalid escape sequence \\.? +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake b/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake new file mode 100644 index 0000000..c6faa7a --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabs.cmake @@ -0,0 +1 @@ +message(${var\ with\ escaped\ tab}) diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt new file mode 100644 index 0000000..915dbaa --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithEscapedTabsQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake:1 + + when parsing string + + \${var\\ with\\ escaped\\ tab} + + Invalid escape sequence \\.? +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake new file mode 100644 index 0000000..d9be763 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithEscapedTabsQuoted.cmake @@ -0,0 +1 @@ +message("${var\ with\ escaped\ tab}") diff --git a/Tests/RunCMake/Syntax/NameWithNewline-result.txt b/Tests/RunCMake/Syntax/NameWithNewline-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewline-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt new file mode 100644 index 0000000..5cc111b --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewline-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithNewline.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithNewline.cmake:1 + + when parsing string + + \${var\\nwith\\nnewline} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithNewline.cmake b/Tests/RunCMake/Syntax/NameWithNewline.cmake new file mode 100644 index 0000000..583bcb0 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewline.cmake @@ -0,0 +1 @@ +message(${var\nwith\nnewline}) diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt new file mode 100644 index 0000000..0067c2f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithNewlineQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake:1 + + when parsing string + + \${var\\nwith\\nnewline} + + syntax error, unexpected cal_SYMBOL, expecting } \(7\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake b/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake new file mode 100644 index 0000000..da6d2cf --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithNewlineQuoted.cmake @@ -0,0 +1 @@ +message("${var\nwith\nnewline}") diff --git a/Tests/RunCMake/Syntax/NameWithSpaces-result.txt b/Tests/RunCMake/Syntax/NameWithSpaces-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpaces-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt new file mode 100644 index 0000000..04bc226 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpaces-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithSpaces.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithSpaces.cmake:1 + + when parsing string + + \${var + + syntax error, unexpected \$end, expecting } \(5\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithSpaces.cmake b/Tests/RunCMake/Syntax/NameWithSpaces.cmake new file mode 100644 index 0000000..01febe9 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpaces.cmake @@ -0,0 +1 @@ +message(${var with space}) diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt new file mode 100644 index 0000000..66cf9a2 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithSpacesQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithSpacesQuoted.cmake:1 + + when parsing string + + \${var with space} + + syntax error, unexpected cal_SYMBOL, expecting } \(17\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithSpacesQuoted.cmake b/Tests/RunCMake/Syntax/NameWithSpacesQuoted.cmake new file mode 100644 index 0000000..3fba53f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithSpacesQuoted.cmake @@ -0,0 +1 @@ +message("${var with space}") diff --git a/Tests/RunCMake/Syntax/NameWithTabs-result.txt b/Tests/RunCMake/Syntax/NameWithTabs-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabs-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt new file mode 100644 index 0000000..e888096 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabs-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithTabs.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithTabs.cmake:1 + + when parsing string + + \${var + + syntax error, unexpected \$end, expecting } \(5\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithTabs.cmake b/Tests/RunCMake/Syntax/NameWithTabs.cmake new file mode 100644 index 0000000..c3b1bea --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabs.cmake @@ -0,0 +1 @@ +message(${var with tab}) diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted-result.txt b/Tests/RunCMake/Syntax/NameWithTabsQuoted-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt new file mode 100644 index 0000000..b020074 --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted-stderr.txt @@ -0,0 +1,12 @@ +^CMake Error at NameWithTabsQuoted.cmake:1 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/NameWithTabsQuoted.cmake:1 + + when parsing string + + \${var with tab} + + syntax error, unexpected cal_SYMBOL, expecting } \(15\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/Syntax/NameWithTabsQuoted.cmake b/Tests/RunCMake/Syntax/NameWithTabsQuoted.cmake new file mode 100644 index 0000000..8ddb85d --- /dev/null +++ b/Tests/RunCMake/Syntax/NameWithTabsQuoted.cmake @@ -0,0 +1 @@ +message("${var with tab}") diff --git a/Tests/RunCMake/Syntax/ParenInVarName0-result.txt b/Tests/RunCMake/Syntax/ParenInVarName0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt new file mode 100644 index 0000000..0a6b60f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName0-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at ParenInVarName0.cmake:4 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/ParenInVarName0.cmake:4 + + when parsing string + + -->\${e\(x\)}<-- + + Invalid character \('\('\) in a variable name: 'e' +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInVarName0.cmake b/Tests/RunCMake/Syntax/ParenInVarName0.cmake new file mode 100644 index 0000000..f863d20 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName0.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0053 NEW) + +set("e(x)" value) +message("-->${e(x)}<--") diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-result.txt b/Tests/RunCMake/Syntax/ParenInVarName1-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName1-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt new file mode 100644 index 0000000..81b1717 --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName1-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at ParenInVarName1.cmake:4 \(message\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/ParenInVarName1.cmake:4 + + when parsing string + + -->\${e\(x\)}<-- + + syntax error, unexpected cal_SYMBOL, expecting } \(10\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/ParenInVarName1.cmake b/Tests/RunCMake/Syntax/ParenInVarName1.cmake new file mode 100644 index 0000000..9fdc87b --- /dev/null +++ b/Tests/RunCMake/Syntax/ParenInVarName1.cmake @@ -0,0 +1,4 @@ +cmake_policy(SET CMP0053 OLD) + +set("{e(x)}" value) +message("-->${e(x)}<--") diff --git a/Tests/RunCMake/Syntax/RunCMakeTest.cmake b/Tests/RunCMake/Syntax/RunCMakeTest.cmake index dcabd8a..cecd338 100644 --- a/Tests/RunCMake/Syntax/RunCMakeTest.cmake +++ b/Tests/RunCMake/Syntax/RunCMakeTest.cmake @@ -5,6 +5,14 @@ run_cmake(BOM-UTF-16-LE) run_cmake(BOM-UTF-16-BE) run_cmake(BOM-UTF-32-LE) run_cmake(BOM-UTF-32-BE) +run_cmake(CMP0053-At-OLD) +run_cmake(CMP0053-At-NEW) +run_cmake(CMP0053-At-WARN) +run_cmake(CMP0053-At-WARN-newlines) +run_cmake(CMP0053-WARN) +run_cmake(CMP0053-NUL) +run_cmake(CMP0053-ParenInENV) +run_cmake(CMP0053-ParenInQuotedENV) run_cmake(CommandSpaces) run_cmake(CommandTabs) run_cmake(CommandNewlines) @@ -25,6 +33,7 @@ run_cmake(StringNoSpace) run_cmake(OneLetter) run_cmake(Unquoted0) run_cmake(Unquoted1) +run_cmake(Unquoted2) run_cmake(Bracket0) run_cmake(Bracket1) run_cmake(Bracket2) @@ -43,12 +52,20 @@ run_cmake(BracketNoSpace3) run_cmake(BracketNoSpace4) run_cmake(BracketNoSpace5) run_cmake(Escape1) +run_cmake(Escape2) +run_cmake(EscapeCharsAllowed) +include("${RunCMake_SOURCE_DIR}/EscapeCharsDisallowed.cmake") run_cmake(ParenNoSpace0) run_cmake(ParenNoSpace1) run_cmake(ParenNoSpace2) +run_cmake(ParenInVarName0) +run_cmake(ParenInVarName1) run_cmake(UnterminatedCall1) run_cmake(UnterminatedCall2) run_cmake(UnterminatedString) +run_cmake(UnterminatedBrace0) +run_cmake(UnterminatedBrace1) +run_cmake(UnterminatedBrace2) run_cmake(UnterminatedBracket0) run_cmake(UnterminatedBracket1) run_cmake(UnterminatedBracketComment) @@ -65,3 +82,29 @@ run_cmake(AtWithVariableFile) run_cmake(AtWithVariableAtOnlyFile) run_cmake(ParenInENV) run_cmake(ParenInQuotedENV) + +# Variable name tests +run_cmake(NameWithSpaces) +run_cmake(NameWithTabs) +run_cmake(NameWithNewline) +run_cmake(NameWithCarriageReturn) +run_cmake(NameWithEscapedSpaces) +run_cmake(NameWithEscapedTabs) +run_cmake(NameWithSpacesQuoted) +run_cmake(NameWithTabsQuoted) +run_cmake(NameWithNewlineQuoted) +run_cmake(NameWithCarriageReturnQuoted) +run_cmake(NameWithEscapedSpacesQuoted) +run_cmake(NameWithEscapedTabsQuoted) +run_cmake(CMP0053-NameWithSpaces) +run_cmake(CMP0053-NameWithTabs) +run_cmake(CMP0053-NameWithNewline) +run_cmake(CMP0053-NameWithCarriageReturn) +run_cmake(CMP0053-NameWithEscapedSpaces) +run_cmake(CMP0053-NameWithEscapedTabs) +run_cmake(CMP0053-NameWithSpacesQuoted) +run_cmake(CMP0053-NameWithTabsQuoted) +run_cmake(CMP0053-NameWithNewlineQuoted) +run_cmake(CMP0053-NameWithCarriageReturnQuoted) +run_cmake(CMP0053-NameWithEscapedSpacesQuoted) +run_cmake(CMP0053-NameWithEscapedTabsQuoted) diff --git a/Tests/RunCMake/Syntax/Unquoted2-stderr.txt b/Tests/RunCMake/Syntax/Unquoted2-stderr.txt new file mode 100644 index 0000000..eb8883e --- /dev/null +++ b/Tests/RunCMake/Syntax/Unquoted2-stderr.txt @@ -0,0 +1 @@ +^\[\[UnquotedBracketArgument1\]\]$ diff --git a/Tests/RunCMake/Syntax/Unquoted2.cmake b/Tests/RunCMake/Syntax/Unquoted2.cmake new file mode 100644 index 0000000..d94057d --- /dev/null +++ b/Tests/RunCMake/Syntax/Unquoted2.cmake @@ -0,0 +1,3 @@ +cmake_policy(SET CMP0053 NEW) + +message(\[[Unquoted Bracket Argument 1]]) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt b/Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace0-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt new file mode 100644 index 0000000..1e0ce49 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace0-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at UnterminatedBrace0.cmake:2 \(set\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake:2 + + when parsing string + + \${ + + syntax error, unexpected \$end, expecting } \(2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake new file mode 100644 index 0000000..0da1290 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace0.cmake @@ -0,0 +1,2 @@ +cmake_minimum_required(VERSION 3.0) +set(var "${") diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt new file mode 100644 index 0000000..4e3c2b5 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace1-stderr.txt @@ -0,0 +1,13 @@ +CMake Warning \(dev\) at UnterminatedBrace1.cmake:3 \(set\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake:3 + + when parsing string + + \${ + + syntax error, unexpected \$end, expecting } \(2\) +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) +This warning is for project developers. Use -Wno-dev to suppress it. diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake new file mode 100644 index 0000000..93fba34 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace1.cmake @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.0) +cmake_policy(SET CMP0010 OLD) +set(var "${") diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt b/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace2-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt b/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt new file mode 100644 index 0000000..b332d34 --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace2-stderr.txt @@ -0,0 +1,12 @@ +CMake Error at UnterminatedBrace2.cmake:4 \(set\): + Syntax error in cmake code at + + .*/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake:4 + + when parsing string + + \${ + + There is an unterminated variable reference. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake b/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake new file mode 100644 index 0000000..a650e5b --- /dev/null +++ b/Tests/RunCMake/Syntax/UnterminatedBrace2.cmake @@ -0,0 +1,4 @@ +cmake_minimum_required(VERSION 3.0) +cmake_policy(SET CMP0010 OLD) +cmake_policy(SET CMP0053 NEW) +set(var "${") |