diff options
Diffstat (limited to 'Tests/RunCMake/FileAPI')
9 files changed, 67 insertions, 0 deletions
diff --git a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake index 1cc10ee..515a4bd 100644 --- a/Tests/RunCMake/FileAPI/RunCMakeTest.cmake +++ b/Tests/RunCMake/FileAPI/RunCMakeTest.cmake @@ -43,3 +43,14 @@ run_cmake(ClientStateless) run_cmake(MixedStateless) run_cmake(DuplicateStateless) run_cmake(ClientStateful) + +function(run_object object) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${object}-build) + run_cmake(${object}) + set(RunCMake_TEST_NO_CLEAN 1) + run_cmake_command(${object}-SharedStateless ${CMAKE_COMMAND} .) + run_cmake_command(${object}-ClientStateless ${CMAKE_COMMAND} .) + run_cmake_command(${object}-ClientStateful ${CMAKE_COMMAND} .) +endfunction() + +run_object(codemodel-v2) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-check.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-check.cmake new file mode 100644 index 0000000..cdbfe7c --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-check.cmake @@ -0,0 +1,11 @@ +set(expect + query + query/client-foo + query/client-foo/query.json + reply + reply/codemodel-v2-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(codemodel-v2) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-prep.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-prep.cmake new file mode 100644 index 0000000..e2b38ff --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateful-prep.cmake @@ -0,0 +1,4 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/client-foo/query.json" [[ +{ "requests": [ { "kind": "codemodel", "version" : 2 } ] } +]]) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-check.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-check.cmake new file mode 100644 index 0000000..612120b --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-check.cmake @@ -0,0 +1,11 @@ +set(expect + query + query/client-foo + query/client-foo/codemodel-v2 + reply + reply/codemodel-v2-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(codemodel-v2) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-prep.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-prep.cmake new file mode 100644 index 0000000..d1ce292 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-ClientStateless-prep.cmake @@ -0,0 +1,2 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/client-foo/codemodel-v2" "") diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-check.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-check.cmake new file mode 100644 index 0000000..2afaeeb --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-check.cmake @@ -0,0 +1,10 @@ +set(expect + query + query/codemodel-v2 + reply + reply/codemodel-v2-[0-9a-f]+.json + reply/index-[0-9.T-]+.json + ) +check_api("^${expect}$") + +check_python(codemodel-v2) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-prep.cmake b/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-prep.cmake new file mode 100644 index 0000000..8a519d5 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-SharedStateless-prep.cmake @@ -0,0 +1,2 @@ +file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query) +file(WRITE "${RunCMake_TEST_BINARY_DIR}/.cmake/api/v1/query/codemodel-v2" "") diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py new file mode 100644 index 0000000..8e65acb --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py @@ -0,0 +1,15 @@ +from check_index import * + +def check_objects(o): + assert is_list(o) + assert len(o) == 1 + check_index_object(o[0], "codemodel", 2, 0, check_object_codemodel) + +def check_object_codemodel(o): + assert sorted(o.keys()) == ["configurations", "kind", "paths", "version"] + # The "kind" and "version" members are handled by check_index_object. + # FIXME: Check "configurations" and "paths" members + +assert is_dict(index) +assert sorted(index.keys()) == ["cmake", "objects", "reply"] +check_objects(index["objects"]) diff --git a/Tests/RunCMake/FileAPI/codemodel-v2.cmake b/Tests/RunCMake/FileAPI/codemodel-v2.cmake new file mode 100644 index 0000000..8c782b9 --- /dev/null +++ b/Tests/RunCMake/FileAPI/codemodel-v2.cmake @@ -0,0 +1 @@ +# FIXME: enable_language(C) and add targets to dump |