aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
diff options
context:
space:
mode:
authorHaojian Wu <hokein.wu@gmail.com>2021-02-08 14:44:02 +0100
committerHaojian Wu <hokein.wu@gmail.com>2021-02-11 09:49:06 +0100
commit35a5e883906f11b63b60574d8737791448dd478f (patch)
treec46ca5ad2b2209c717c05988a015ab1a70e1c00a /clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
parentbe9bbb57f4739e4653cee77979f6fb72310176c0 (diff)
downloadllvm-35a5e883906f11b63b60574d8737791448dd478f.zip
llvm-35a5e883906f11b63b60574d8737791448dd478f.tar.gz
llvm-35a5e883906f11b63b60574d8737791448dd478f.tar.bz2
[Syntax] NFC, Simplify a test with annotations
Diffstat (limited to 'clang/unittests/Tooling/Syntax/BuildTreeTest.cpp')
-rw-r--r--clang/unittests/Tooling/Syntax/BuildTreeTest.cpp94
1 files changed, 35 insertions, 59 deletions
diff --git a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
index 1f950b0..a76557d 100644
--- a/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
+++ b/clang/unittests/Tooling/Syntax/BuildTreeTest.cpp
@@ -4768,67 +4768,43 @@ TranslationUnit Detached
}
TEST_P(BuildSyntaxTreeTest, ParametersAndQualifiers_InFreeFunctions_Named) {
- EXPECT_TRUE(treeDumpEqual(
+ EXPECT_TRUE(treeDumpEqualOnAnnotations(
R"cpp(
-int func1(int a);
-int func2(int *ap);
-int func3(int a, float b);
-)cpp",
- R"txt(
-TranslationUnit Detached
-|-SimpleDeclaration
-| |-'int'
-| |-DeclaratorList Declarators
-| | `-SimpleDeclarator ListElement
-| | |-'func1'
-| | `-ParametersAndQualifiers
-| | |-'(' OpenParen
-| | |-ParameterDeclarationList Parameters
-| | | `-SimpleDeclaration ListElement
-| | | |-'int'
-| | | `-DeclaratorList Declarators
-| | | `-SimpleDeclarator ListElement
-| | | `-'a'
-| | `-')' CloseParen
-| `-';'
-|-SimpleDeclaration
-| |-'int'
-| |-DeclaratorList Declarators
-| | `-SimpleDeclarator ListElement
-| | |-'func2'
-| | `-ParametersAndQualifiers
-| | |-'(' OpenParen
-| | |-ParameterDeclarationList Parameters
-| | | `-SimpleDeclaration ListElement
-| | | |-'int'
-| | | `-DeclaratorList Declarators
-| | | `-SimpleDeclarator ListElement
-| | | |-'*'
-| | | `-'ap'
-| | `-')' CloseParen
-| `-';'
-`-SimpleDeclaration
+ int func1([[int a]]);
+ int func2([[int *ap]]);
+ int func3([[int a, float b]]);
+ )cpp",
+ {R"txt(
+ParameterDeclarationList Parameters
+`-SimpleDeclaration ListElement
|-'int'
- |-DeclaratorList Declarators
- | `-SimpleDeclarator ListElement
- | |-'func3'
- | `-ParametersAndQualifiers
- | |-'(' OpenParen
- | |-ParameterDeclarationList Parameters
- | | |-SimpleDeclaration ListElement
- | | | |-'int'
- | | | `-DeclaratorList Declarators
- | | | `-SimpleDeclarator ListElement
- | | | `-'a'
- | | |-',' ListDelimiter
- | | `-SimpleDeclaration ListElement
- | | |-'float'
- | | `-DeclaratorList Declarators
- | | `-SimpleDeclarator ListElement
- | | `-'b'
- | `-')' CloseParen
- `-';'
-)txt"));
+ `-DeclaratorList Declarators
+ `-SimpleDeclarator ListElement
+ `-'a'
+)txt",
+ R"txt(
+ParameterDeclarationList Parameters
+`-SimpleDeclaration ListElement
+ |-'int'
+ `-DeclaratorList Declarators
+ `-SimpleDeclarator ListElement
+ |-'*'
+ `-'ap'
+)txt",
+ R"txt(
+ParameterDeclarationList Parameters
+|-SimpleDeclaration ListElement
+| |-'int'
+| `-DeclaratorList Declarators
+| `-SimpleDeclarator ListElement
+| `-'a'
+|-',' ListDelimiter
+`-SimpleDeclaration ListElement
+ |-'float'
+ `-DeclaratorList Declarators
+ `-SimpleDeclarator ListElement
+ `-'b'
+)txt"}));
}
TEST_P(BuildSyntaxTreeTest, ParametersAndQualifiers_InFreeFunctions_Unnamed) {