Page MenuHomePhabricator

[SyntaxTree] Test `findFirstLeaf` and `findLastLeaf`
ClosedPublic

Authored by eduucaldas on Sep 16 2020, 11:09 AM.

Details

Summary
  • Introduce TreeTest.cpp to unit test Tree.h
  • Add generateAllTreesWithShape to generating test cases
  • Add tests for findFirstLeaf and findLastLeaf
  • Fix implementations of findFirstLeaf and findLastLeaf that had been broken when empty Tree were present.

Builds upon https://reviews.llvm.org/D87749

Diff Detail

Event Timeline

eduucaldas created this revision.Sep 16 2020, 11:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2020, 11:09 AM
eduucaldas requested review of this revision.Sep 16 2020, 11:09 AM
eduucaldas edited the summary of this revision. (Show Details)Sep 16 2020, 11:09 AM
eduucaldas added a reviewer: gribozavr2.
eduucaldas edited the summary of this revision. (Show Details)Sep 16 2020, 10:50 PM
gribozavr2 added inline comments.Sep 18 2020, 2:26 PM
clang/unittests/Tooling/Syntax/TreeTest.cpp
9

Please elaborate what "base API" covers -- specifically, what classes and such. However, I'm not sure it is necessary to have this comment at all. Up to you.

39

Is this copied from somewhere? I feel like other tests have this function already. Can we share?

52

under => into?

eduucaldas marked 3 inline comments as done.
  • Answer Review
  • Change names in generateAllTreesWithShape
  • auto x = vector() -> vector x;

Comment generateAllTreesWithShape

gribozavr2 accepted this revision.Sep 21 2020, 10:14 AM
This revision is now accepted and ready to land.Sep 21 2020, 10:14 AM
This revision was automatically updated to reflect the committed changes.