diff options
author | ChenMoFeiJin <1424865872@qq.com> | 2023-09-07 12:04:02 (GMT) |
---|---|---|
committer | ChenMoFeiJin <1424865872@qq.com> | 2023-09-12 10:18:37 (GMT) |
commit | f1a717952020401502a109de7af211130251a067 (patch) | |
tree | 9b0503da4aa0fc58209c717169b4827ac749ff27 /Tests | |
parent | f83771dfceb9d800d17955219b33e50eb155cc04 (diff) | |
download | CMake-f1a717952020401502a109de7af211130251a067.zip CMake-f1a717952020401502a109de7af211130251a067.tar.gz CMake-f1a717952020401502a109de7af211130251a067.tar.bz2 |
presets: Add $schema property to JSON schema
Many modern code editors have support for JSON Schema. When you specify
the `$schema` property in a JSON file, the editor can provide features
like auto-completion, error checking, etc., which can improve your
efficiency when writing and modifying the `CMakePresets.json` file.
Diffstat (limited to 'Tests')
6 files changed, 20 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake index c4a8b3f..88027fb 100644 --- a/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMakePresets/RunCMakeTest.cmake @@ -153,6 +153,13 @@ run_cmake_presets(ConditionFuture) run_cmake_presets(SubConditionNull) run_cmake_presets(TraceNotSupported) +set(CMakePresets_NO_PRESET 1) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) +run_cmake_presets(SchemaSupported --list-presets) +set(CMakePresets_SCHEMA_EXPECTED_RESULT 1) +run_cmake_presets(SchemaNotSupported --list-presets) +unset(CMakePresets_NO_PRESET) + # Test cmakeMinimumRequired field run_cmake_presets(MinimumRequiredInvalid) set(CMakePresets_SCHEMA_EXPECTED_RESULT 0) diff --git a/Tests/RunCMake/CMakePresets/SchemaNotSupported-result.txt b/Tests/RunCMake/CMakePresets/SchemaNotSupported-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SchemaNotSupported-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CMakePresets/SchemaNotSupported-stderr.txt b/Tests/RunCMake/CMakePresets/SchemaNotSupported-stderr.txt new file mode 100644 index 0000000..2df4b3d --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SchemaNotSupported-stderr.txt @@ -0,0 +1,3 @@ +^CMake Error: Could not read presets from [^ +]*/Tests/RunCMake/CMakePresets/SchemaNotSupported: +File version must be 8 or higher for [$]schema support$ diff --git a/Tests/RunCMake/CMakePresets/SchemaNotSupported.json.in b/Tests/RunCMake/CMakePresets/SchemaNotSupported.json.in new file mode 100644 index 0000000..736f307 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SchemaNotSupported.json.in @@ -0,0 +1,4 @@ +{ + "version": 7, + "$schema": "https://example.com/schema.json" +} diff --git a/Tests/RunCMake/CMakePresets/SchemaSupported-result.txt b/Tests/RunCMake/CMakePresets/SchemaSupported-result.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SchemaSupported-result.txt @@ -0,0 +1 @@ +0 diff --git a/Tests/RunCMake/CMakePresets/SchemaSupported.json.in b/Tests/RunCMake/CMakePresets/SchemaSupported.json.in new file mode 100644 index 0000000..5426131 --- /dev/null +++ b/Tests/RunCMake/CMakePresets/SchemaSupported.json.in @@ -0,0 +1,4 @@ +{ + "version": 8, + "$schema": "https://example.com/schema.json" +} |