summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clangd/FileIndexTests.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-06-15 08:55:00 +0000
committerEric Liu <ioeric@google.com>2018-06-15 08:55:00 +0000
commit13e503f68a0ec42807c46aa76540b3eb06450b9d (patch)
treea4ad95a19d776794ffa1226b0ffc76fe70548b1f /clang-tools-extra/unittests/clangd/FileIndexTests.cpp
parent0651eb1b31ce0ab3e2dd88947f38de7e3ebc8bc9 (diff)
downloadbcm5719-llvm-13e503f68a0ec42807c46aa76540b3eb06450b9d.tar.gz
bcm5719-llvm-13e503f68a0ec42807c46aa76540b3eb06450b9d.zip
[clangd] Customizable URI schemes for dynamic index.
Summary: This allows dynamic index to have consistent URI schemes with the static index which can have customized URI schemes, which would make file proximity scoring based on URIs easier. Reviewers: sammccall Reviewed By: sammccall Subscribers: ilya-biryukov, MaskRay, jkorous, cfe-commits Differential Revision: https://reviews.llvm.org/D47931 llvm-svn: 334809
Diffstat (limited to 'clang-tools-extra/unittests/clangd/FileIndexTests.cpp')
-rw-r--r--clang-tools-extra/unittests/clangd/FileIndexTests.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/FileIndexTests.cpp b/clang-tools-extra/unittests/clangd/FileIndexTests.cpp
index 3d73ef3143d..1f00e4a4d30 100644
--- a/clang-tools-extra/unittests/clangd/FileIndexTests.cpp
+++ b/clang-tools-extra/unittests/clangd/FileIndexTests.cpp
@@ -96,6 +96,20 @@ void update(FileIndex &M, llvm::StringRef Basename, llvm::StringRef Code) {
M.update(File.Filename, &AST.getASTContext(), AST.getPreprocessorPtr());
}
+TEST(FileIndexTest, CustomizedURIScheme) {
+ FileIndex M({"unittest"});
+ update(M, "f", "class string {};");
+
+ FuzzyFindRequest Req;
+ Req.Query = "";
+ bool SeenSymbol = false;
+ M.fuzzyFind(Req, [&](const Symbol &Sym) {
+ EXPECT_EQ(Sym.CanonicalDeclaration.FileURI, "unittest:///f.h");
+ SeenSymbol = true;
+ });
+ EXPECT_TRUE(SeenSymbol);
+}
+
TEST(FileIndexTest, IndexAST) {
FileIndex M;
update(M, "f1", "namespace ns { void f() {} class X {}; }");
OpenPOWER on IntegriCloud