[clang] b4093d6 - [SyntaxTree] Split FreeStandingClass tests
Eduardo Caldas via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 24 07:32:03 PDT 2020
Author: Eduardo Caldas
Date: 2020-08-24T14:31:45Z
New Revision: b4093d663f8377b3ca3746ff104c83c9c5510c0a
URL: https://github.com/llvm/llvm-project/commit/b4093d663f8377b3ca3746ff104c83c9c5510c0a
DIFF: https://github.com/llvm/llvm-project/commit/b4093d663f8377b3ca3746ff104c83c9c5510c0a.diff
LOG: [SyntaxTree] Split FreeStandingClass tests
Differential Revision: https://reviews.llvm.org/D86440
Added:
Modified:
clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
Removed:
################################################################################
diff --git a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
index 93f510e0a890..8dbf99c32db8 100644
--- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -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 X;]]
+[[struct Y *y1;]]
+)cpp",
+ {R"txt(
+SimpleDeclaration
+|-struct
+|-X
+`-;
+)txt",
+ R"txt(
+SimpleDeclaration
+|-struct
+|-Y
+|-SimpleDeclarator
+| |-*
+| `-y1
+`-;
+)txt"}));
+}
-struct {} *a1;
+TEST_P(SyntaxTreeTest, FreeStandingClasses_Definition) {
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
+ R"cpp(
+[[struct X {};]]
+[[struct Y {} *y2;]]
+[[struct {} *a1;]]
)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
+| |-*
+| `-y2
+`-;
+)txt",
+ R"txt(
+SimpleDeclaration
+|-struct
+|-{
+|-}
+|-SimpleDeclarator
+| |-*
+| `-a1
+`-;
+)txt"}));
}
TEST_P(SyntaxTreeTest, StaticMemberFunction) {
More information about the cfe-commits
mailing list