[clang-tools-extra] 16c8709 - [unittest] Use UnorderedElementsAre for StringMap keys

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 2 13:39:53 PST 2023


Author: Fangrui Song
Date: 2023-02-02T13:39:47-08:00
New Revision: 16c8709cf61b0787cb3e4e283e158d9f86d8d6d5

URL: https://github.com/llvm/llvm-project/commit/16c8709cf61b0787cb3e4e283e158d9f86d8d6d5
DIFF: https://github.com/llvm/llvm-project/commit/16c8709cf61b0787cb3e4e283e158d9f86d8d6d5.diff

LOG: [unittest] Use UnorderedElementsAre for StringMap keys

Added: 
    

Modified: 
    clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp b/clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
index 7a1fb9863af1a..b32875fe19500 100644
--- a/clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
+++ b/clang-tools-extra/clangd/unittests/BackgroundIndexTests.cpp
@@ -580,8 +580,9 @@ TEST_F(BackgroundIndexTest, UncompilableFiles) {
   CDB.setCompileCommand(testPath("build/../A.cc"), Cmd);
   ASSERT_TRUE(Idx.blockUntilIdleForTest());
 
-  EXPECT_THAT(Storage.keys(), ElementsAre(testPath("A.cc"), testPath("A.h"),
-                                          testPath("B.h"), testPath("C.h")));
+  EXPECT_THAT(Storage.keys(),
+              UnorderedElementsAre(testPath("A.cc"), testPath("A.h"),
+                                   testPath("B.h"), testPath("C.h")));
 
   {
     auto Shard = MSS.loadShard(testPath("A.cc"));
@@ -635,7 +636,8 @@ TEST_F(BackgroundIndexTest, CmdLineHash) {
   CDB.setCompileCommand(testPath("build/../A.cc"), Cmd);
   ASSERT_TRUE(Idx.blockUntilIdleForTest());
 
-  EXPECT_THAT(Storage.keys(), ElementsAre(testPath("A.cc"), testPath("A.h")));
+  EXPECT_THAT(Storage.keys(),
+              UnorderedElementsAre(testPath("A.cc"), testPath("A.h")));
   // Make sure we only store the Cmd for main file.
   EXPECT_FALSE(MSS.loadShard(testPath("A.h"))->Cmd);
 


        


More information about the cfe-commits mailing list