diff options
author | Brad King <brad.king@kitware.com> | 2024-06-26 12:45:03 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2024-06-26 12:45:17 (GMT) |
commit | f879d3a33f7bfdb8b7d0e5cf19e3ff6fd14f7469 (patch) | |
tree | e7788f9c64caabd643daa14f972b14fbe53e841d /Tests | |
parent | a20377e41afddb974539378cc8065d9e9f38b151 (diff) | |
parent | 7d2cc6ece6952bea119b3ee2d0f8cd908ac750f7 (diff) | |
download | CMake-f879d3a33f7bfdb8b7d0e5cf19e3ff6fd14f7469.zip CMake-f879d3a33f7bfdb8b7d0e5cf19e3ff6fd14f7469.tar.gz CMake-f879d3a33f7bfdb8b7d0e5cf19e3ff6fd14f7469.tar.bz2 |
Merge topic 'preset-comments'
7d2cc6ece6 presets: Allow comments in presets files
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9608
Diffstat (limited to 'Tests')
14 files changed, 229 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakePresets/CommentValid-result.txt b/Tests/RunCMake/CMakePresets/CommentValid-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValid-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMakePresets/CommentValid.cmake b/Tests/RunCMake/CMakePresets/CommentValid.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValid.cmake diff --git a/Tests/RunCMake/CMakePresets/CommentValid.json.in b/Tests/RunCMake/CMakePresets/CommentValid.json.in new file mode 100644 index 0000000..1206ded --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValid.json.in @@ -0,0 +1,14 @@ +{ + "$comment": [ + "example comment", + "with an array of strings" + ], + "version": 10, + "configurePresets": [ + { + "name": "CommentValid", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/CommentValidFull-result.txt b/Tests/RunCMake/CMakePresets/CommentValidFull-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValidFull-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMakePresets/CommentValidFull.cmake b/Tests/RunCMake/CMakePresets/CommentValidFull.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValidFull.cmake diff --git a/Tests/RunCMake/CMakePresets/CommentValidFull.json.in b/Tests/RunCMake/CMakePresets/CommentValidFull.json.in new file mode 100644 index 0000000..40bab97 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValidFull.json.in @@ -0,0 +1,179 @@ +{ + "$comment": [ + "example comment", + "with an array of strings" + ], + "version": 10, + "cmakeMinimumRequired": { + "$comment": "We can add comments in version" + }, + "configurePresets": [ + { + "name": "CommentValidFull", + "$comment": "example comment", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build", + "architecture": { + "$comment": "We can add comments in architecture", + "value": "v143", + "strategy": "external" + }, + "toolset": { + "$comment": "We can add comments in toolset", + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "SOME_VARIABLE": { + "$comment": "We can add comments in every cacheVariable, that we created", + "value": "SOME_VALUE" + } + }, + "warnings": { + "$comment": "We can add comments in warnings", + "dev": false + }, + "errors": { + "$comment": "We can add comments in errors", + "dev": false + }, + "debug": { + "$comment": "We can add comments in debug", + "find": false + }, + "trace": { + "$comment": "We can add comments in trace", + "mode": "off" + } + } + ], + "buildPresets": [ + { + "$comment": "example comment", + "name": "default", + "condition": { + "$comment": "We can add comments in condition", + "type": "const", + "value": false + }, + "configurePreset": "CommentValidFull" + } + ], + "testPresets": [ + { + "name": "default", + "configurePreset": "CommentValidFull", + "filter": { + "$comment": "We can add comments in filter", + "include": { + "$comment": ["example comment", "with an array of strings", "inside include"], + "index": { + "$comment": ["example comment", "with an array of strings"], + "start": 0 + } + }, + "exclude": { + "$comment": ["example comment", "with an array of strings", "inside exclude"], + "fixtures": { + "$comment": ["example comment", "with an array of strings"], + "any": ".*full.*" + } + } + }, + "execution": { + "$comment": ["example comment", "with an array of strings"], + "repeat": { + "$comment": "Some comments here", + "mode": "until-fail", + "count": 1 + } + }, + "condition": { + "$comment": "We can add comments in equal & non-equal conditions", + "type": "equals", + "lhs": "test1", + "rhs": "test2" + }, + "$comment": ["example comment", "with an array of strings"] + } + ], + "packagePresets": [ + { + "name": "CommentValidFull", + "$comment": ["example comment", "with an array of strings"], + "configurePreset": "CommentValidFull", + "condition": { + "$comment": "We can add comments in list check conditions", + "type": "notInList", + "list": [ + "test1", + "test2" + ], + "string": "test1" + }, + "output": { + "$comment": "Hello, World!", + "debug": false + } + }, + { + "name": "CommentValidFull1", + "configurePreset": "CommentValidFull", + "condition": { + "$comment": "We can add comments in aggregation conditions", + "type": "allOf", + "conditions": [ + { + "$comment": "We can add comments in regex match conditions", + "type": "matches", + "regex": ".*tests.*", + "string": "test1" + }, + { + "type": "matches", + "regex": ".*tests.*", + "string": "test2" + }, + { + "type": "not", + "$comment": "We can add comments in not conditions", + "condition": { + "type": "matches", + "regex": ".*tests.*", + "string": "test3" + } + } + ] + }, + "output": { + "$comment": "Hello, World 123!", + "verbose": false + } + } + ], + "workflowPresets": [ + { + "name": "CommentValidFull", + "$comment": ["example comment", "with an array of strings"], + "steps": [ + { + "type": "configure", + "name": "CommentValidFull" + }, + { + "type": "build", + "name": "default" + }, + { + "$comment": "We must test it before we can package it", + "type": "test", + "name": "default" + }, + { + "type": "package", + "name": "CommentValidFull" + } + ] + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/CommentValidOldSchema-result.txt b/Tests/RunCMake/CMakePresets/CommentValidOldSchema-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValidOldSchema-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/CommentValidOldSchema-stderr.txt b/Tests/RunCMake/CMakePresets/CommentValidOldSchema-stderr.txt new file mode 100644 index 0000000..b102f5b --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValidOldSchema-stderr.txt @@ -0,0 +1,2 @@ +^CMake Error: Could not read presets from .* +Error: @2,15: Invalid extra field \"\$comment\" in root object diff --git a/Tests/RunCMake/CMakePresets/CommentValidOldSchema.cmake b/Tests/RunCMake/CMakePresets/CommentValidOldSchema.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValidOldSchema.cmake diff --git a/Tests/RunCMake/CMakePresets/CommentValidOldSchema.json.in b/Tests/RunCMake/CMakePresets/CommentValidOldSchema.json.in new file mode 100644 index 0000000..d92ee1d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/CommentValidOldSchema.json.in @@ -0,0 +1,14 @@ +{ + "$comment": [ + "invalid comment", + "version less than 10" + ], + "version": 9, + "configurePresets": [ + { + "name": "CommentValidOldSchema", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/NoCommentValid-result.txt b/Tests/RunCMake/CMakePresets/NoCommentValid-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoCommentValid-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMakePresets/NoCommentValid.cmake b/Tests/RunCMake/CMakePresets/NoCommentValid.cmake new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoCommentValid.cmake diff --git a/Tests/RunCMake/CMakePresets/NoCommentValid.json.in b/Tests/RunCMake/CMakePresets/NoCommentValid.json.in new file mode 100644 index 0000000..cf10ee2 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/NoCommentValid.json.in @@ -0,0 +1,10 @@ +{ + "version": 10, + "configurePresets": [ + { + "name": "NoCommentValid", + "generator": "@RunCMake_GENERATOR@", + "binaryDir": "${sourceDir}/build" + } + ] +} diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index 2ec0a43..081f3bb 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -92,6 +92,12 @@ endfunction() set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) run_cmake_presets(NoCMakePresets) run_cmake_presets(Comment) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) +run_cmake_presets(NoCommentValid) +run_cmake_presets(CommentValid) +run_cmake_presets(CommentValidFull) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) +run_cmake_presets(CommentValidOldSchema) run_cmake_presets(JSONParseError) run_cmake_presets(InvalidRoot) run_cmake_presets(NoVersion) |