Try to fix FileDistance test on windows.
authorEric Liu <ioeric@google.com>
Wed, 4 Jul 2018 09:08:40 +0000 (09:08 +0000)
committerEric Liu <ioeric@google.com>
Wed, 4 Jul 2018 09:08:40 +0000 (09:08 +0000)
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11510/steps/ninja%20check%201/logs/FAIL%3A%20Extra%20Tools%20Unit%20Tests%3A%3AFileDistanceTests.URI

llvm-svn: 336249

clang-tools-extra/unittests/clangd/FileDistanceTests.cpp

index 8e55e31..3b525ae 100644 (file)
@@ -67,9 +67,15 @@ TEST(FileDistanceTests, URI) {
   SourceParams CostLots;
   CostLots.Cost = 1000;
 
-  URIDistance D(
-      {{testPath("foo"), CostLots}, {"/not/a/testpath", SourceParams()}}, Opts);
+  URIDistance D({{testPath("foo"), CostLots},
+                 {"/not/a/testpath", SourceParams()},
+                 {"C:\\not\\a\\testpath", SourceParams()}},
+                Opts);
+#ifdef _WIN32
+  EXPECT_EQ(D.distance("file:///C%3a/not/a/testpath/either"), 3u);
+#else
   EXPECT_EQ(D.distance("file:///not/a/testpath/either"), 3u);
+#endif
   EXPECT_EQ(D.distance("unittest:foo"), 1000u);
   EXPECT_EQ(D.distance("unittest:bar"), 1008u);
 }