r288976 - [RecursiveASTVisitor] Improve post-order traversal unit test

Malcolm Parsons via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 7 12:38:21 PST 2016


Author: malcolm.parsons
Date: Wed Dec  7 14:38:20 2016
New Revision: 288976

URL: http://llvm.org/viewvc/llvm-project?rev=288976&view=rev
Log:
[RecursiveASTVisitor] Improve post-order traversal unit test

Modified:
    cfe/trunk/unittests/AST/PostOrderASTVisitor.cpp

Modified: cfe/trunk/unittests/AST/PostOrderASTVisitor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/PostOrderASTVisitor.cpp?rev=288976&r1=288975&r2=288976&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/PostOrderASTVisitor.cpp (original)
+++ cfe/trunk/unittests/AST/PostOrderASTVisitor.cpp Wed Dec  7 14:38:20 2016
@@ -81,7 +81,7 @@ TEST(RecursiveASTVisitor, PostOrderTrave
   auto ASTUnit = tooling::buildASTFromCode(
     "class A {"
     "  class B {"
-    "    int foo() { while(4) { int i = 9; int j = -i; } return (1 + 3) + 2; }"
+    "    int foo() { while(4) { int i = 9; int j = -5; } return (1 + 3) + 2; }"
     "  };"
     "};"
   );
@@ -91,9 +91,9 @@ TEST(RecursiveASTVisitor, PostOrderTrave
   RecordingVisitor Visitor(true);
   Visitor.TraverseTranslationUnitDecl(TU);
 
-  std::vector<std::string> expected = {
-    "4", "9", "i", "-", "j", "1", "3", "+", "2", "+", "return", "A::B::foo", "A::B", "A"
-  };
+  std::vector<std::string> expected = {"4", "9",      "i",         "5",    "-",
+                                       "j", "1",      "3",         "+",    "2",
+                                       "+", "return", "A::B::foo", "A::B", "A"};
   // Compare the list of actually visited nodes
   // with the expected list of visited nodes.
   ASSERT_EQ(expected.size(), Visitor.VisitedNodes.size());




More information about the cfe-commits mailing list