[clang-tools-extra] 4419b2c - [clangd] Make tidy-rename tests conditional
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 23 02:41:27 PST 2024
Author: Kadir Cetinkaya
Date: 2024-02-23T11:39:14+01:00
New Revision: 4419b2c27fa45a08bc3892ad0c8c5eb95d96d608
URL: https://github.com/llvm/llvm-project/commit/4419b2c27fa45a08bc3892ad0c8c5eb95d96d608
DIFF: https://github.com/llvm/llvm-project/commit/4419b2c27fa45a08bc3892ad0c8c5eb95d96d608.diff
LOG: [clangd] Make tidy-rename tests conditional
Added:
Modified:
clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
index 555c4c57499819..75a140767035b2 100644
--- a/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp
@@ -11,6 +11,7 @@
#include "ClangdServer.h"
#include "ConfigProvider.h"
#include "Diagnostics.h"
+#include "Feature.h"
#include "FeatureModule.h"
#include "LSPBinder.h"
#include "LSPClient.h"
@@ -198,6 +199,9 @@ TEST_F(LSPTest, RecordsLatencies) {
// clang-tidy's renames are converted to clangd's internal rename functionality,
// see clangd#1589 and clangd#741
TEST_F(LSPTest, ClangTidyRename) {
+ // This test requires clang-tidy checks to be linked in.
+ if (!CLANGD_TIDY_CHECKS)
+ return;
Annotations Header(R"cpp(
void [[foo]]();
)cpp");
@@ -214,7 +218,9 @@ TEST_F(LSPTest, ClangTidyRename) {
Client.didOpen("foo.hpp", Header.code());
Client.didOpen("foo.cpp", Source.code());
- auto RenameDiag = Client.diagnostics("foo.cpp").value().at(0);
+ auto Diags = Client.diagnostics("foo.cpp");
+ ASSERT_TRUE(Diags && !Diags->empty());
+ auto RenameDiag = Diags->front();
auto RenameCommand =
(*Client
More information about the cfe-commits
mailing list