[PATCH] D126608: [clangd] Remove a test with a duplicate of FileCacheTests

2022-05-31 Thread Yuki Okushi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5c1494039491: [clangd] Remove a test with a duplicate of 
FileCacheTests (authored by JohnTitor).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126608/new/

https://reviews.llvm.org/D126608

Files:
  clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp


Index: clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
===
--- clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
+++ clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
@@ -178,44 +178,6 @@
   EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("bar", "baz"));
 }
 
-// FIXME: delete this test, it's covered by FileCacheTests.
-TEST(ProviderTest, Staleness) {
-  MockFS FS;
-
-  auto StartTime = std::chrono::steady_clock::now();
-  Params StaleOK;
-  StaleOK.FreshTime = StartTime;
-  Params MustBeFresh;
-  MustBeFresh.FreshTime = StartTime + std::chrono::hours(1);
-  CapturedDiags Diags;
-  auto P = Provider::fromYAMLFile(testPath("foo.yaml"), /*Directory=*/"", FS);
-
-  // Initial query always reads, regardless of policy.
-  FS.Files["foo.yaml"] = AddFooWithErr;
-  auto Cfg = P->getConfig(StaleOK, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics,
-  ElementsAre(diagMessage("Unknown CompileFlags key 'Unknown'")));
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("foo"));
-  Diags.clear();
-
-  // Stale value reused by policy.
-  FS.Files["foo.yaml"] = AddBarBaz;
-  Cfg = P->getConfig(StaleOK, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty()) << "Cached, not re-parsed";
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("foo"));
-
-  // Cache revalidated by policy.
-  Cfg = P->getConfig(MustBeFresh, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty()) << "New config, no errors";
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("bar", "baz"));
-
-  // Cache revalidated by (default) policy.
-  FS.Files.erase("foo.yaml");
-  Cfg = P->getConfig(Params(), Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty());
-  EXPECT_THAT(getAddedArgs(Cfg), IsEmpty());
-}
-
 TEST(ProviderTest, SourceInfo) {
   MockFS FS;
 


Index: clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
===
--- clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
+++ clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
@@ -178,44 +178,6 @@
   EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("bar", "baz"));
 }
 
-// FIXME: delete this test, it's covered by FileCacheTests.
-TEST(ProviderTest, Staleness) {
-  MockFS FS;
-
-  auto StartTime = std::chrono::steady_clock::now();
-  Params StaleOK;
-  StaleOK.FreshTime = StartTime;
-  Params MustBeFresh;
-  MustBeFresh.FreshTime = StartTime + std::chrono::hours(1);
-  CapturedDiags Diags;
-  auto P = Provider::fromYAMLFile(testPath("foo.yaml"), /*Directory=*/"", FS);
-
-  // Initial query always reads, regardless of policy.
-  FS.Files["foo.yaml"] = AddFooWithErr;
-  auto Cfg = P->getConfig(StaleOK, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics,
-  ElementsAre(diagMessage("Unknown CompileFlags key 'Unknown'")));
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("foo"));
-  Diags.clear();
-
-  // Stale value reused by policy.
-  FS.Files["foo.yaml"] = AddBarBaz;
-  Cfg = P->getConfig(StaleOK, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty()) << "Cached, not re-parsed";
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("foo"));
-
-  // Cache revalidated by policy.
-  Cfg = P->getConfig(MustBeFresh, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty()) << "New config, no errors";
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("bar", "baz"));
-
-  // Cache revalidated by (default) policy.
-  FS.Files.erase("foo.yaml");
-  Cfg = P->getConfig(Params(), Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty());
-  EXPECT_THAT(getAddedArgs(Cfg), IsEmpty());
-}
-
 TEST(ProviderTest, SourceInfo) {
   MockFS FS;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126608: [clangd] Remove a test with a duplicate of FileCacheTests

2022-05-31 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Thanks!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126608/new/

https://reviews.llvm.org/D126608

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D126608: [clangd] Remove a test with a duplicate of FileCacheTests

2022-05-28 Thread Yuki Okushi via Phabricator via cfe-commits
JohnTitor created this revision.
Herald added subscribers: usaxena95, kadircet, arphaman.
Herald added a project: All.
JohnTitor requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.

FIXME says it should be removed so followed it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126608

Files:
  clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp


Index: clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
===
--- clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
+++ clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
@@ -178,44 +178,6 @@
   EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("bar", "baz"));
 }
 
-// FIXME: delete this test, it's covered by FileCacheTests.
-TEST(ProviderTest, Staleness) {
-  MockFS FS;
-
-  auto StartTime = std::chrono::steady_clock::now();
-  Params StaleOK;
-  StaleOK.FreshTime = StartTime;
-  Params MustBeFresh;
-  MustBeFresh.FreshTime = StartTime + std::chrono::hours(1);
-  CapturedDiags Diags;
-  auto P = Provider::fromYAMLFile(testPath("foo.yaml"), /*Directory=*/"", FS);
-
-  // Initial query always reads, regardless of policy.
-  FS.Files["foo.yaml"] = AddFooWithErr;
-  auto Cfg = P->getConfig(StaleOK, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics,
-  ElementsAre(diagMessage("Unknown CompileFlags key 'Unknown'")));
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("foo"));
-  Diags.clear();
-
-  // Stale value reused by policy.
-  FS.Files["foo.yaml"] = AddBarBaz;
-  Cfg = P->getConfig(StaleOK, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty()) << "Cached, not re-parsed";
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("foo"));
-
-  // Cache revalidated by policy.
-  Cfg = P->getConfig(MustBeFresh, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty()) << "New config, no errors";
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("bar", "baz"));
-
-  // Cache revalidated by (default) policy.
-  FS.Files.erase("foo.yaml");
-  Cfg = P->getConfig(Params(), Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty());
-  EXPECT_THAT(getAddedArgs(Cfg), IsEmpty());
-}
-
 TEST(ProviderTest, SourceInfo) {
   MockFS FS;
 


Index: clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
===
--- clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
+++ clang-tools-extra/clangd/unittests/ConfigProviderTests.cpp
@@ -178,44 +178,6 @@
   EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("bar", "baz"));
 }
 
-// FIXME: delete this test, it's covered by FileCacheTests.
-TEST(ProviderTest, Staleness) {
-  MockFS FS;
-
-  auto StartTime = std::chrono::steady_clock::now();
-  Params StaleOK;
-  StaleOK.FreshTime = StartTime;
-  Params MustBeFresh;
-  MustBeFresh.FreshTime = StartTime + std::chrono::hours(1);
-  CapturedDiags Diags;
-  auto P = Provider::fromYAMLFile(testPath("foo.yaml"), /*Directory=*/"", FS);
-
-  // Initial query always reads, regardless of policy.
-  FS.Files["foo.yaml"] = AddFooWithErr;
-  auto Cfg = P->getConfig(StaleOK, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics,
-  ElementsAre(diagMessage("Unknown CompileFlags key 'Unknown'")));
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("foo"));
-  Diags.clear();
-
-  // Stale value reused by policy.
-  FS.Files["foo.yaml"] = AddBarBaz;
-  Cfg = P->getConfig(StaleOK, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty()) << "Cached, not re-parsed";
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("foo"));
-
-  // Cache revalidated by policy.
-  Cfg = P->getConfig(MustBeFresh, Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty()) << "New config, no errors";
-  EXPECT_THAT(getAddedArgs(Cfg), ElementsAre("bar", "baz"));
-
-  // Cache revalidated by (default) policy.
-  FS.Files.erase("foo.yaml");
-  Cfg = P->getConfig(Params(), Diags.callback());
-  EXPECT_THAT(Diags.Diagnostics, IsEmpty());
-  EXPECT_THAT(getAddedArgs(Cfg), IsEmpty());
-}
-
 TEST(ProviderTest, SourceInfo) {
   MockFS FS;
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits