[RecursiveASTVisitor] Improve post-order traversal unit test

llvm-svn: 288976
This commit is contained in:
Malcolm Parsons 2016-12-07 20:38:20 +00:00
parent 007f9f3e3d
commit a29d98fcb5
1 changed files with 4 additions and 4 deletions

View 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());