[PATCH] D73463: [clangd] use SCOPED_TRACE to better trace the testcase in test failure, NFC

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 27 05:17:28 PST 2020


hokein created this revision.
hokein added a reviewer: kadircet.
Herald added subscribers: usaxena95, arphaman, jkorous, MaskRay, ilya-biryukov.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73463

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


Index: clang-tools-extra/clangd/unittests/RenameTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -442,6 +442,7 @@
       )cpp",
   };
   for (llvm::StringRef T : Tests) {
+    SCOPED_TRACE(T);
     Annotations Code(T);
     auto TU = TestTU::withCode(Code.code());
     TU.ExtraArgs.push_back("-fno-delayed-template-parsing");
@@ -560,6 +561,7 @@
   };
 
   for (const auto& Case : Cases) {
+    SCOPED_TRACE(Case.Code);
     Annotations T(Case.Code);
     TestTU TU = TestTU::withCode(T.code());
     TU.HeaderCode = CommonHeader;
@@ -886,6 +888,7 @@
   };
 
   for (const auto& T : Cases) {
+    SCOPED_TRACE(T.FooH);
     Annotations FooH(T.FooH);
     Annotations FooCC(T.FooCC);
     std::string FooHPath = testPath("foo.h");
@@ -1012,6 +1015,7 @@
   LangOptions LangOpts;
   LangOpts.CPlusPlus = true;
   for (const auto &T : Tests) {
+    SCOPED_TRACE(T.DraftCode);
     Annotations Draft(T.DraftCode);
     auto ActualRanges = adjustRenameRanges(
         Draft.code(), "x", Annotations(T.IndexedCode).ranges(), LangOpts);
@@ -1019,8 +1023,7 @@
        EXPECT_THAT(Draft.ranges(), testing::IsEmpty());
     else
       EXPECT_THAT(Draft.ranges(),
-                  testing::UnorderedElementsAreArray(*ActualRanges))
-          << T.DraftCode;
+                  testing::UnorderedElementsAreArray(*ActualRanges));
   }
 }
 
@@ -1127,6 +1130,7 @@
     }
   };
   for (const auto &T : Tests) {
+    SCOPED_TRACE(T.IndexedCode);
     auto Lexed = Annotations(T.LexedCode);
     auto LexedRanges = Lexed.ranges();
     std::vector<Range> ExpectedMatches;
@@ -1143,8 +1147,7 @@
     if (!Mapped)
       EXPECT_THAT(ExpectedMatches, IsEmpty());
     else
-      EXPECT_THAT(ExpectedMatches, UnorderedElementsAreArray(*Mapped))
-          << T.IndexedCode;
+      EXPECT_THAT(ExpectedMatches, UnorderedElementsAreArray(*Mapped));
   }
 }
 
@@ -1247,13 +1250,14 @@
     },
   };
   for (const auto &T : Tests) {
+    SCOPED_TRACE(T.RangeCode);
     Annotations C(T.RangeCode);
     std::vector<size_t> MappedIndex;
     for (size_t I = 0; I < C.ranges("lex").size(); ++I)
       MappedIndex.push_back(I);
     EXPECT_EQ(renameRangeAdjustmentCost(C.ranges("idx"), C.ranges("lex"),
                                         MappedIndex),
-              T.ExpectedCost) << T.RangeCode;
+              T.ExpectedCost);
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73463.240536.patch
Type: text/x-patch
Size: 2467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200127/e54cdb79/attachment-0001.bin>


More information about the cfe-commits mailing list