forked from OSchip/llvm-project
[clangd] Avoid redundant testcases in rename unittest, NFC.
Reviewers: kadircet Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D73035
This commit is contained in:
parent
7fee4fed4c
commit
3de9a5db62
|
@ -215,7 +215,7 @@ std::vector<SourceLocation> findOccurrencesWithinFile(ParsedAST &AST,
|
|||
// getUSRsForDeclaration will find other related symbols, e.g. virtual and its
|
||||
// overriddens, primary template and all explicit specializations.
|
||||
// FIXME: Get rid of the remaining tooling APIs.
|
||||
const auto RenameDecl =
|
||||
const auto *RenameDecl =
|
||||
ND.getDescribedTemplate() ? ND.getDescribedTemplate() : &ND;
|
||||
std::vector<std::string> RenameUSRs =
|
||||
tooling::getUSRsForDeclaration(RenameDecl, AST.getASTContext());
|
||||
|
|
|
@ -722,7 +722,7 @@ TEST(CrossFileRenameTests, WithUpToDateIndex) {
|
|||
void onDiagnosticsReady(PathRef File,
|
||||
std::vector<Diag> Diagnostics) override {}
|
||||
} DiagConsumer;
|
||||
// rename is runnning on the "^" point in FooH, and "[[]]" ranges are the
|
||||
// rename is runnning on all "^" points in FooH, and "[[]]" ranges are the
|
||||
// expected rename occurrences.
|
||||
struct Case {
|
||||
llvm::StringRef FooH;
|
||||
|
@ -763,28 +763,10 @@ TEST(CrossFileRenameTests, WithUpToDateIndex) {
|
|||
)cpp",
|
||||
},
|
||||
{
|
||||
// Constructor.
|
||||
// rename on constructor and destructor.
|
||||
R"cpp(
|
||||
class [[Foo]] {
|
||||
[[^Foo]]();
|
||||
~[[Foo]]();
|
||||
};
|
||||
)cpp",
|
||||
R"cpp(
|
||||
#include "foo.h"
|
||||
[[Foo]]::[[Foo]]() {}
|
||||
[[Foo]]::~[[Foo]]() {}
|
||||
|
||||
void func() {
|
||||
[[Foo]] foo;
|
||||
}
|
||||
)cpp",
|
||||
},
|
||||
{
|
||||
// Destructor (selecting before the identifier).
|
||||
R"cpp(
|
||||
class [[Foo]] {
|
||||
[[Foo]]();
|
||||
~[[Foo^]]();
|
||||
};
|
||||
)cpp",
|
||||
|
@ -891,14 +873,17 @@ TEST(CrossFileRenameTests, WithUpToDateIndex) {
|
|||
runAddDocument(Server, FooCCPath, FooCC.code());
|
||||
|
||||
llvm::StringRef NewName = "NewName";
|
||||
for (const auto &RenamePos : FooH.points()) {
|
||||
auto FileEditsList =
|
||||
llvm::cantFail(runRename(Server, FooHPath, FooH.point(), NewName));
|
||||
EXPECT_THAT(applyEdits(std::move(FileEditsList)),
|
||||
llvm::cantFail(runRename(Server, FooHPath, RenamePos, NewName));
|
||||
EXPECT_THAT(
|
||||
applyEdits(std::move(FileEditsList)),
|
||||
UnorderedElementsAre(
|
||||
Pair(Eq(FooHPath), Eq(expectedResult(T.FooH, NewName))),
|
||||
Pair(Eq(FooCCPath), Eq(expectedResult(T.FooCC, NewName)))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(CrossFileRenameTests, CrossFileOnLocalSymbol) {
|
||||
// cross-file rename should work for function-local symbols, even there is no
|
||||
|
|
Loading…
Reference in New Issue