[PATCH] D58133: [clangd] Testcase for bug 39811
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 20 01:41:34 PST 2019
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL354442: [clangd] Testcase for bug 39811 (authored by kadircet, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58133/new/
https://reviews.llvm.org/D58133
Files:
clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp
Index: clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp
===================================================================
--- clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp
+++ clang-tools-extra/trunk/unittests/clangd/XRefsTests.cpp
@@ -1441,6 +1441,35 @@
}
}
+TEST(GoTo, WithSysRoot) {
+ const char *CustoomRoot = "/sys/root/";
+ Annotations Main(R"cpp(
+ #include "header.h"
+ int main() {
+ return f^oo();
+ })cpp");
+ Annotations Header("int [[foo]](){return 42;}");
+
+ MockCompilationDatabase CDB;
+ CDB.ExtraClangFlags = {"--sysroot", CustoomRoot};
+ IgnoreDiagnostics DiagConsumer;
+ MockFSProvider FS;
+ ClangdServer Server(CDB, FS, DiagConsumer, ClangdServer::optsForTest());
+
+ // Fill the filesystem.
+ auto FooCpp = testPath("foo.cpp");
+ FS.Files[FooCpp] = Main.code();
+ auto HeaderPath = (llvm::StringRef(CustoomRoot) + "include/header.h").str();
+ FS.Files[HeaderPath] = Header.code();
+
+ runAddDocument(Server, FooCpp, Main.code());
+
+ // Go to a definition in main source file.
+ auto Locations = runLocateSymbolAt(Server, FooCpp, Main.point());
+ EXPECT_TRUE(bool(Locations)) << "findDefinitions returned an error";
+ EXPECT_THAT(*Locations, ElementsAre(Sym("foo", Header.range())));
+}
+
} // namespace
} // namespace clangd
} // namespace clang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58133.187532.patch
Type: text/x-patch
Size: 1337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190220/e9ba30ef/attachment.bin>
More information about the cfe-commits
mailing list