[SyntaxTree] Split FreeStandingClass tests

Differential Revision: https://reviews.llvm.org/D86440
This commit is contained in:
Eduardo Caldas 2020-08-24 10:07:27 +00:00
parent ed83095254
commit b4093d663f
1 changed files with 57 additions and 47 deletions

View File

@ -2515,55 +2515,65 @@ UsingDeclaration
)txt"}));
}
TEST_P(SyntaxTreeTest, FreeStandingClasses) {
// Free-standing classes, must live inside a SimpleDeclaration.
EXPECT_TRUE(treeDumpEqual(
TEST_P(SyntaxTreeTest, FreeStandingClass_ForwardDeclaration) {
EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
struct X;
struct X {};
struct Y *y1;
struct Y {} *y2;
struct {} *a1;
[[struct X;]]
[[struct Y *y1;]]
)cpp",
R"txt(
*: TranslationUnit
|-SimpleDeclaration
| |-struct
| |-X
| `-;
|-SimpleDeclaration
| |-struct
| |-X
| |-{
| |-}
| `-;
|-SimpleDeclaration
| |-struct
| |-Y
| |-SimpleDeclarator
| | |-*
| | `-y1
| `-;
|-SimpleDeclaration
| |-struct
| |-Y
| |-{
| |-}
| |-SimpleDeclarator
| | |-*
| | `-y2
| `-;
`-SimpleDeclaration
|-struct
|-{
|-}
|-SimpleDeclarator
| |-*
| `-a1
`-;
)txt"));
{R"txt(
SimpleDeclaration
|-struct
|-X
`-;
)txt",
R"txt(
SimpleDeclaration
|-struct
|-Y
|-SimpleDeclarator
| |-*
| `-y1
`-;
)txt"}));
}
TEST_P(SyntaxTreeTest, FreeStandingClasses_Definition) {
EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
[[struct X {};]]
[[struct Y {} *y2;]]
[[struct {} *a1;]]
)cpp",
{R"txt(
SimpleDeclaration
|-struct
|-X
|-{
|-}
`-;
)txt",
R"txt(
SimpleDeclaration
|-struct
|-Y
|-{
|-}
|-SimpleDeclarator
| |-*
| `-y2
`-;
)txt",
R"txt(
SimpleDeclaration
|-struct
|-{
|-}
|-SimpleDeclarator
| |-*
| `-a1
`-;
)txt"}));
}
TEST_P(SyntaxTreeTest, StaticMemberFunction) {