Skip to content

Commit 4419b2c

Browse files
committed
[clangd] Make tidy-rename tests conditional
1 parent 5cb2ebc commit 4419b2c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clang-tools-extra/clangd/unittests/ClangdLSPServerTests.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "ClangdServer.h"
1212
#include "ConfigProvider.h"
1313
#include "Diagnostics.h"
14+
#include "Feature.h"
1415
#include "FeatureModule.h"
1516
#include "LSPBinder.h"
1617
#include "LSPClient.h"
@@ -198,6 +199,9 @@ TEST_F(LSPTest, RecordsLatencies) {
198199
// clang-tidy's renames are converted to clangd's internal rename functionality,
199200
// see clangd#1589 and clangd#741
200201
TEST_F(LSPTest, ClangTidyRename) {
202+
// This test requires clang-tidy checks to be linked in.
203+
if (!CLANGD_TIDY_CHECKS)
204+
return;
201205
Annotations Header(R"cpp(
202206
void [[foo]]();
203207
)cpp");
@@ -214,7 +218,9 @@ TEST_F(LSPTest, ClangTidyRename) {
214218
Client.didOpen("foo.hpp", Header.code());
215219
Client.didOpen("foo.cpp", Source.code());
216220

217-
auto RenameDiag = Client.diagnostics("foo.cpp").value().at(0);
221+
auto Diags = Client.diagnostics("foo.cpp");
222+
ASSERT_TRUE(Diags && !Diags->empty());
223+
auto RenameDiag = Diags->front();
218224

219225
auto RenameCommand =
220226
(*Client

0 commit comments

Comments
 (0)