diff --git a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp --- a/clang-tools-extra/clangd/unittests/FindTargetTests.cpp +++ b/clang-tools-extra/clangd/unittests/FindTargetTests.cpp @@ -101,6 +101,9 @@ << Code using ExpectedDecls = std::vector; +#define EXPECT_NO_DECLS(NodeType) \ + EXPECT_THAT(assertNodeAndPrintDecls(NodeType), ::testing::IsEmpty()) << Code + TEST_F(TargetDeclTest, Exprs) { Code = R"cpp( int f(); @@ -340,7 +343,7 @@ [[auto]] X = S{}; )cpp"; // FIXME: deduced type missing in AST. https://llvm.org/PR42914 - EXPECT_DECLS("AutoTypeLoc"); + EXPECT_NO_DECLS("AutoTypeLoc"); Code = R"cpp( template @@ -944,7 +947,7 @@ void test(C<[[Foo]]> *p); )cpp"; // FIXME: there's no AST node corresponding to 'Foo', so we're stuck. - EXPECT_DECLS("ObjCObjectTypeLoc"); + EXPECT_NO_DECLS("ObjCObjectTypeLoc"); } class FindExplicitReferencesTest : public ::testing::Test { diff --git a/clang-tools-extra/clangd/unittests/SelectionTests.cpp b/clang-tools-extra/clangd/unittests/SelectionTests.cpp --- a/clang-tools-extra/clangd/unittests/SelectionTests.cpp +++ b/clang-tools-extra/clangd/unittests/SelectionTests.cpp @@ -641,10 +641,11 @@ AST.getASTContext(), AST.getTokens(), Test.point("ambiguous"), Test.point("ambiguous"), [&](SelectionTree T) { // Expect to see the right-biased tree first. - if (Seen == 0) + if (Seen == 0) { EXPECT_EQ("BinaryOperator", nodeKind(T.commonAncestor())); - else if (Seen == 1) + } else if (Seen == 1) { EXPECT_EQ("IntegerLiteral", nodeKind(T.commonAncestor())); + } ++Seen; return false; });