Author: Eduardo Caldas
Date: 2020-09-21T06:11:46Z
New Revision: bb5b28f12fbd029773dc93d18a82ef42f4889b2a

URL: 
https://github.com/llvm/llvm-project/commit/bb5b28f12fbd029773dc93d18a82ef42f4889b2a
DIFF: 
https://github.com/llvm/llvm-project/commit/bb5b28f12fbd029773dc93d18a82ef42f4889b2a.diff

LOG: [SyntaxTree][Synthesis] Improve testing `createLeaf`

The new test shows that `createLeaf` depends on the C++ version.

Differential Revision: https://reviews.llvm.org/D87896

Added: 
    

Modified: 
    clang/unittests/Tooling/Syntax/SynthesisTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Tooling/Syntax/SynthesisTest.cpp 
b/clang/unittests/Tooling/Syntax/SynthesisTest.cpp
index a882714ccf33..8d9fb706eac3 100644
--- a/clang/unittests/Tooling/Syntax/SynthesisTest.cpp
+++ b/clang/unittests/Tooling/Syntax/SynthesisTest.cpp
@@ -51,6 +51,19 @@ TEST_P(SynthesisTest, Leaf_Punctuation) {
   )txt"));
 }
 
+TEST_P(SynthesisTest, Leaf_Punctuation_CXX) {
+  if (!GetParam().isCXX())
+    return;
+
+  buildTree("", GetParam());
+
+  auto *Leaf = createLeaf(*Arena, tok::coloncolon);
+
+  EXPECT_TRUE(treeDumpEqual(Leaf, R"txt(
+'::' Detached synthesized
+  )txt"));
+}
+
 TEST_P(SynthesisTest, Leaf_Keyword) {
   buildTree("", GetParam());
 
@@ -61,6 +74,19 @@ TEST_P(SynthesisTest, Leaf_Keyword) {
   )txt"));
 }
 
+TEST_P(SynthesisTest, Leaf_Keyword_CXX11) {
+  if (!GetParam().isCXX11OrLater())
+    return;
+
+  buildTree("", GetParam());
+
+  auto *Leaf = createLeaf(*Arena, tok::kw_nullptr);
+
+  EXPECT_TRUE(treeDumpEqual(Leaf, R"txt(
+'nullptr' Detached synthesized
+  )txt"));
+}
+
 TEST_P(SynthesisTest, Leaf_Identifier) {
   buildTree("", GetParam());
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to