Author: Haojian Wu
Date: 2020-01-28T12:23:26+01:00
New Revision: dea11473db38d03cbfd77f0d46e92dceb202a24a

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

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

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D73463

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp 
b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 6d62d1ee944b..620cdd0f483e 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -442,6 +442,7 @@ TEST(RenameTest, WithinFileRename) {
       )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 @@ TEST(RenameTest, Renameable) {
   };
 
   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 @@ TEST(CrossFileRenameTests, WithUpToDateIndex) {
   };
 
   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 @@ TEST(CrossFileRenameTests, adjustRenameRanges) {
   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 @@ TEST(CrossFileRenameTests, adjustRenameRanges) {
        EXPECT_THAT(Draft.ranges(), testing::IsEmpty());
     else
       EXPECT_THAT(Draft.ranges(),
-                  testing::UnorderedElementsAreArray(*ActualRanges))
-          << T.DraftCode;
+                  testing::UnorderedElementsAreArray(*ActualRanges));
   }
 }
 
@@ -1127,6 +1130,7 @@ TEST(RangePatchingHeuristic, GetMappedRanges) {
     }
   };
   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 @@ TEST(RangePatchingHeuristic, GetMappedRanges) {
     if (!Mapped)
       EXPECT_THAT(ExpectedMatches, IsEmpty());
     else
-      EXPECT_THAT(ExpectedMatches, UnorderedElementsAreArray(*Mapped))
-          << T.IndexedCode;
+      EXPECT_THAT(ExpectedMatches, UnorderedElementsAreArray(*Mapped));
   }
 }
 
@@ -1247,13 +1250,14 @@ TEST(CrossFileRenameTests, adjustmentCost) {
     },
   };
   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);
   }
 }
 


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

Reply via email to