[clang-tools-extra] r323703 - [clangd] Fix r323658 test failure on windows.
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 29 14:28:08 PST 2018
Author: ioeric
Date: Mon Jan 29 14:28:08 2018
New Revision: 323703
URL: http://llvm.org/viewvc/llvm-project?rev=323703&view=rev
Log:
[clangd] Fix r323658 test failure on windows.
Modified:
clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp
clang-tools-extra/trunk/unittests/clangd/TestFS.cpp
clang-tools-extra/trunk/unittests/clangd/TestFS.h
Modified: clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp?rev=323703&r1=323702&r2=323703&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/SymbolCollectorTests.cpp Mon Jan 29 14:28:08 2018
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include "TestFS.h"
#include "index/SymbolCollector.h"
#include "index/SymbolYAML.h"
#include "clang/Basic/FileManager.h"
@@ -44,7 +45,7 @@ MATCHER_P(Snippet, S, "") {
return arg.CompletionSnippetInsertText == S;
}
MATCHER_P(QName, Name, "") { return (arg.Scope + arg.Name).str() == Name; }
-MATCHER_P(Path, P, "") { return arg.CanonicalDeclaration.FilePath == P; }
+MATCHER_P(CPath, P, "") { return arg.CanonicalDeclaration.FilePath == P; }
namespace clang {
namespace clangd {
@@ -156,15 +157,16 @@ TEST_F(SymbolCollectorTest, SymbolRelati
CollectorOpts.IndexMainFiles = false;
runSymbolCollector("class Foo {};", /*Main=*/"");
EXPECT_THAT(Symbols,
- UnorderedElementsAre(AllOf(QName("Foo"), Path("symbols.h"))));
+ UnorderedElementsAre(AllOf(QName("Foo"), CPath("symbols.h"))));
}
TEST_F(SymbolCollectorTest, SymbolRelativeWithFallback) {
CollectorOpts.IndexMainFiles = false;
- CollectorOpts.FallbackDir = "/cwd";
+ CollectorOpts.FallbackDir = getVirtualTestRoot();
runSymbolCollector("class Foo {};", /*Main=*/"");
- EXPECT_THAT(Symbols, UnorderedElementsAre(
- AllOf(QName("Foo"), Path("/cwd/symbols.h"))));
+ EXPECT_THAT(Symbols,
+ UnorderedElementsAre(AllOf(
+ QName("Foo"), CPath(getVirtualTestFilePath("symbols.h")))));
}
TEST_F(SymbolCollectorTest, IncludeEnums) {
Modified: clang-tools-extra/trunk/unittests/clangd/TestFS.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/TestFS.cpp?rev=323703&r1=323702&r2=323703&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/TestFS.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/TestFS.cpp Mon Jan 29 14:28:08 2018
@@ -159,7 +159,7 @@ MockCompilationDatabase::getCompileComma
std::move(CommandLine), "")};
}
-static const char *getVirtualTestRoot() {
+const char *getVirtualTestRoot() {
#ifdef LLVM_ON_WIN32
return "C:\\clangd-test";
#else
Modified: clang-tools-extra/trunk/unittests/clangd/TestFS.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/TestFS.h?rev=323703&r1=323702&r2=323703&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/TestFS.h (original)
+++ clang-tools-extra/trunk/unittests/clangd/TestFS.h Mon Jan 29 14:28:08 2018
@@ -45,6 +45,9 @@ public:
std::vector<std::string> ExtraClangFlags;
};
+// Returns an absolute (fake) test directory for this OS.
+const char *getVirtualTestRoot();
+
// Returns a suitable absolute path for this OS.
llvm::SmallString<32> getVirtualTestFilePath(PathRef File);
More information about the cfe-commits
mailing list