summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-10-06 16:09:38 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-10-06 16:09:38 (GMT)
commita395cb516bacb43d082075779055b88c646e2e80 (patch)
tree0037dafff2bf1c20db00ec4560740ba7a7e84d2f /Tests
parent8c4c658ab062f2920448a02fe3a5d42fe3d48876 (diff)
downloadCMake-a395cb516bacb43d082075779055b88c646e2e80.zip
CMake-a395cb516bacb43d082075779055b88c646e2e80.tar.gz
CMake-a395cb516bacb43d082075779055b88c646e2e80.tar.bz2
CMakePresets.json: Prohibit empty variable names
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakePresets/CMakePresets.json.in16
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyEnv-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt2
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in13
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyPenv-result.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt1
-rw-r--r--Tests/RunCMake/CMakePresets/RunCMakeTest.cmake4
12 files changed, 56 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakePresets/CMakePresets.json.in b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
index 78e31c6..8bfc602 100644
--- a/Tests/RunCMake/CMakePresets/CMakePresets.json.in
+++ b/Tests/RunCMake/CMakePresets/CMakePresets.json.in
@@ -335,6 +335,22 @@
}
},
{
+ "name": "EmptyEnv",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "MY_VAR": "$env{}"
+ }
+ },
+ {
+ "name": "EmptyPenv",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "MY_VAR": "$penv{}"
+ }
+ },
+ {
"name": "UseHiddenPreset",
"generator": "@RunCMake_GENERATOR@",
"binaryDir": "${sourceDir}/build",
diff --git a/Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt b/Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt
new file mode 100644
index 0000000..749d306
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/EmptyCacheKey: Invalid preset$
diff --git a/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in b/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in
new file mode 100644
index 0000000..ea9c9e4
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyCacheKey.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "EmptyCacheKey",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "": "value"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/EmptyEnv-result.txt b/Tests/RunCMake/CMakePresets/EmptyEnv-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyEnv-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt
new file mode 100644
index 0000000..9c9c025
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyEnv-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Could not evaluate preset "EmptyEnv": Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt b/Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt
new file mode 100644
index 0000000..365f537
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error: Could not read presets from [^
+]*/Tests/RunCMake/CMakePresets/EmptyEnvKey: Invalid preset$
diff --git a/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in b/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in
new file mode 100644
index 0000000..d87c159
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyEnvKey.json.in
@@ -0,0 +1,13 @@
+{
+ "version": 1,
+ "configurePresets": [
+ {
+ "name": "EmptyEnvKey",
+ "generator": "@RunCMake_GENERATOR@",
+ "binaryDir": "${sourceDir}/build",
+ "environment": {
+ "": "value"
+ }
+ }
+ ]
+}
diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt b/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyPenv-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt b/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt
new file mode 100644
index 0000000..395c7b4
--- /dev/null
+++ b/Tests/RunCMake/CMakePresets/EmptyPenv-stderr.txt
@@ -0,0 +1 @@
+^CMake Error: Could not evaluate preset "EmptyPenv": Invalid macro expansion$
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
index f591964..4b430b3 100644
--- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake
@@ -90,6 +90,8 @@ run_cmake_presets(ErrorNoWarningDev)
run_cmake_presets(ErrorNoWarningDeprecated)
run_cmake_presets(InvalidCMakeGeneratorConfig)
run_cmake_presets(UnknownCMakeGeneratorConfig)
+run_cmake_presets(EmptyCacheKey)
+run_cmake_presets(EmptyEnvKey)
# Test cmakeMinimumRequired field
run_cmake_presets(MinimumRequiredInvalid)
@@ -143,6 +145,8 @@ run_cmake_presets(NoSuchMacro)
run_cmake_presets(VendorMacro)
run_cmake_presets(InvalidGenerator)
run_cmake_presets(EnvCycle)
+run_cmake_presets(EmptyEnv)
+run_cmake_presets(EmptyPenv)
# Test Visual Studio-specific stuff
if(RunCMake_GENERATOR MATCHES "^Visual Studio ")