[PATCH] D85962: [SyntaxTree] Create annotations infrastructure and apply it in expression tests.

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 14 05:32:26 PDT 2020


gribozavr2 added inline comments.


================
Comment at: clang/unittests/Tooling/Syntax/TreeTestBase.cpp:197
+
+  bool failed = false;
+  auto AnnotatedRanges = AnnotatedCode.ranges();
----------------



================
Comment at: clang/unittests/Tooling/Syntax/TreeTestBase.cpp:199
+  auto AnnotatedRanges = AnnotatedCode.ranges();
+  assert(AnnotatedRanges.size() == TreeDumps.size());
+  for (auto i = 0ul; i < AnnotatedRanges.size(); i++) {
----------------
ASSERT_EQ I think would be better.


================
Comment at: clang/unittests/Tooling/Syntax/TreeTestBase.cpp:200
+  assert(AnnotatedRanges.size() == TreeDumps.size());
+  for (auto i = 0ul; i < AnnotatedRanges.size(); i++) {
+    auto *AnnotatedNode = nodeByRange(AnnotatedRanges[i], Root);
----------------
LLVM style is usually:

unsigned i = 0; ...


================
Comment at: clang/unittests/Tooling/Syntax/TreeTestBase.cpp:206
+    // EXPECT_EQ shows the diff between the two strings if they are different.
+    EXPECT_EQ(TreeDumps[i].trim().str(), AnnotatedNodeDump);
+    if (AnnotatedNodeDump != TreeDumps[i].trim().str())
----------------
Could you dump the annotated source code substring to make debugging failing tests easier?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85962



More information about the cfe-commits mailing list