[RecursiveASTVisitor] Improve post-order traversal unit test
authorMalcolm Parsons <malcolm.parsons@gmail.com>
Wed, 7 Dec 2016 20:38:20 +0000 (20:38 +0000)
committerMalcolm Parsons <malcolm.parsons@gmail.com>
Wed, 7 Dec 2016 20:38:20 +0000 (20:38 +0000)
llvm-svn: 288976

clang/unittests/AST/PostOrderASTVisitor.cpp

index ee17f14..2921f3e 100644 (file)
@@ -81,7 +81,7 @@ TEST(RecursiveASTVisitor, PostOrderTraversal) {
   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, PostOrderTraversal) {
   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());