diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2019-04-29 08:44:01 +0000 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2019-04-29 08:44:01 +0000 |
| commit | b804eef09052cf40e79aa2ed8a23f2f39e2dda1b (patch) | |
| tree | 7315d3e6ad44c8898b9952d3fdaeb523ec47bf8b /clang-tools-extra/clangd/unittests/xpc | |
| parent | e62915bcc1a1f40e9846f58388c2b32bee76000c (diff) | |
| download | bcm5719-llvm-b804eef09052cf40e79aa2ed8a23f2f39e2dda1b.tar.gz bcm5719-llvm-b804eef09052cf40e79aa2ed8a23f2f39e2dda1b.zip | |
[clangd] Move clangd tests to clangd directory. check-clangd is no longer part of check-clang-tools.
Summary:
Motivation:
- this layout is a pain to work with
- without a common root, it's painful to express things like "disable clangd" (D61122)
- CMake/lit configs are a maintenance hazard, and the more the one-off hacks
for various tools are entangled, the more we see apathy and non-ownership.
This attempts to use the bare-minimum configuration needed (while still
supporting the difficult cases: windows, standalone clang build, dynamic libs).
In particular the lit.cfg.py and lit.site.cfg.py.in are merged into lit.cfg.in.
The logic in these files is now minimal.
(Much of clang-tools-extra's lit configs can probably be cleaned up by reusing
lit.llvm.llvm_config.use_clang(), and every llvm project does its own version of
LDPATH mangling. I haven't attempted to fix any of those).
Docs are still in clang-tools-extra/docs, I don't have any plans to touch those.
Reviewers: gribozavr
Subscribers: mgorny, javed.absar, MaskRay, jkorous, arphaman, kadircet, jfb, cfe-commits, ilya-biryukov, thakis
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61187
llvm-svn: 359424
Diffstat (limited to 'clang-tools-extra/clangd/unittests/xpc')
| -rw-r--r-- | clang-tools-extra/clangd/unittests/xpc/CMakeLists.txt | 21 | ||||
| -rw-r--r-- | clang-tools-extra/clangd/unittests/xpc/ConversionTests.cpp | 35 |
2 files changed, 56 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/unittests/xpc/CMakeLists.txt b/clang-tools-extra/clangd/unittests/xpc/CMakeLists.txt new file mode 100644 index 00000000000..229ad5af47e --- /dev/null +++ b/clang-tools-extra/clangd/unittests/xpc/CMakeLists.txt @@ -0,0 +1,21 @@ +set(LLVM_LINK_COMPONENTS + support + ) + +get_filename_component(CLANGD_SOURCE_DIR + ${CMAKE_CURRENT_SOURCE_DIR}/../../clangd REALPATH) +include_directories( + ${CLANGD_SOURCE_DIR} + ) + +add_extra_unittest(ClangdXpcTests + ConversionTests.cpp + ) + +target_link_libraries(ClangdXpcTests + PRIVATE + clangdXpcJsonConversions + clangDaemon + LLVMSupport + LLVMTestingSupport + ) diff --git a/clang-tools-extra/clangd/unittests/xpc/ConversionTests.cpp b/clang-tools-extra/clangd/unittests/xpc/ConversionTests.cpp new file mode 100644 index 00000000000..5d0efd83509 --- /dev/null +++ b/clang-tools-extra/clangd/unittests/xpc/ConversionTests.cpp @@ -0,0 +1,35 @@ +//===-- ConversionTests.cpp --------------------------*- C++ -*-----------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "xpc/Conversion.h" +#include "gtest/gtest.h" + +#include <limits> + +namespace clang { +namespace clangd { +namespace { + +using namespace llvm; + +TEST(JsonXpcConversionTest, JsonToXpcToJson) { + + for (auto &testcase : + {json::Value(false), json::Value(3.14), json::Value(42), + json::Value(-100), json::Value("foo"), json::Value(""), + json::Value("123"), json::Value(" "), + json::Value{true, "foo", nullptr, 42}, + json::Value(json::Object{ + {"a", true}, {"b", "foo"}, {"c", nullptr}, {"d", 42}})}) { + EXPECT_TRUE(testcase == xpcToJson(jsonToXpc(testcase))) << testcase; + } +} + +} // namespace +} // namespace clangd +} // namespace clang |

