diff options
Diffstat (limited to 'Tests/RunCMake')
6 files changed, 171 insertions, 2 deletions
diff --git a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt index b4b170e..03286f1 100644 --- a/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt +++ b/Tests/RunCMake/CommandLine/E_capabilities-stdout.txt @@ -1 +1 @@ -^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":0}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":true,"version":{.*}}$ +^{"fileApi":{"requests":\[{"kind":"codemodel","version":\[{"major":2,"minor":1}]},{"kind":"cache","version":\[{"major":2,"minor":0}]},{"kind":"cmakeFiles","version":\[{"major":1,"minor":0}]}]},"generators":\[.*\],"serverMode":true,"version":{.*}}$ diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py index 143e784..a3dd9ff 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -12,7 +12,7 @@ def read_codemodel_json_data(filename): def check_objects(o, g): assert is_list(o) assert len(o) == 1 - check_index_object(o[0], "codemodel", 2, 0, check_object_codemodel(g)) + check_index_object(o[0], "codemodel", 2, 1, check_object_codemodel(g)) def check_backtrace(t, b, backtrace): btg = t["backtraceGraph"] @@ -404,6 +404,23 @@ def check_target(c): missing_exception=lambda e: "Include path: %s" % e["path"], extra_exception=lambda a: "Include path: %s" % a["path"]) + if "precompileHeaders" in expected: + expected_keys.append("precompileHeaders") + + def check_precompile_header(actual, expected): + assert is_dict(actual) + expected_keys = ["backtrace", "header"] + check_backtrace(obj, actual["backtrace"], expected["backtrace"]) + + assert sorted(actual.keys()) == sorted(expected_keys) + + check_list_match(lambda a, e: matches(a["header"], e["header"]), + actual["precompileHeaders"], expected["precompileHeaders"], + check=check_precompile_header, + check_exception=lambda a, e: "Precompile header: %s" % a["header"], + missing_exception=lambda e: "Precompile header: %s" % e["header"], + extra_exception=lambda a: "Precompile header: %s" % a["header"]) + if expected["defines"] is not None: expected_keys.append("defines") diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json index 2d3eec6..e7ab55b 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json @@ -43,6 +43,25 @@ ], "includes": null, "defines": null, + "precompileHeaders": [ + { + "header": ".*empty\\.h$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 21, + "command": "target_precompile_headers", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "compileCommandFragments": [ { "fragment" : "TargetCompileOptions", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json index 0695a00..5a0f770 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader.json @@ -7,6 +7,25 @@ ], "includes": null, "defines": null, + "precompileHeaders": [ + { + "header": ".*empty\\.h$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 21, + "command": "target_precompile_headers", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "compileCommandFragments": [ { "fragment": "TargetCompileOptions", @@ -34,6 +53,25 @@ ], "includes": null, "defines": null, + "precompileHeaders": [ + { + "header": ".*empty\\.h$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 21, + "command": "target_precompile_headers", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "compileCommandFragments": [ { "fragment": "TargetCompileOptions", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json index d42b835..9455748 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_2arch.json @@ -7,6 +7,25 @@ ], "includes": null, "defines": null, + "precompileHeaders": [ + { + "header": ".*empty\\.h$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 21, + "command": "target_precompile_headers", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "compileCommandFragments": [ { "fragment": "TargetCompileOptions", @@ -34,6 +53,25 @@ ], "includes": null, "defines": null, + "precompileHeaders": [ + { + "header": ".*empty\\.h$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 21, + "command": "target_precompile_headers", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "compileCommandFragments": [ { "fragment": "TargetCompileOptions", @@ -61,6 +99,25 @@ ], "includes": null, "defines": null, + "precompileHeaders": [ + { + "header": ".*empty\\.h$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 21, + "command": "target_precompile_headers", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "compileCommandFragments": [ { "fragment": "TargetCompileOptions", diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json index 9250017..9f6ffcc 100644 --- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json +++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe_precompileheader_multigen.json @@ -7,6 +7,25 @@ ], "includes": null, "defines": null, + "precompileHeaders": [ + { + "header": ".*empty\\.h$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 21, + "command": "target_precompile_headers", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "compileCommandFragments": [ { "fragment": "TargetCompileOptions", @@ -34,6 +53,25 @@ ], "includes": null, "defines": null, + "precompileHeaders": [ + { + "header": ".*empty\\.h$", + "backtrace": [ + { + "file": "^cxx/CMakeLists\\.txt$", + "line": 21, + "command": "target_precompile_headers", + "hasParent": true + }, + { + "file": "^cxx/CMakeLists\\.txt$", + "line": null, + "command": null, + "hasParent": false + } + ] + } + ], "compileCommandFragments": [ { "fragment": "TargetCompileOptions", |