[SyntaxTree][Synthesis] Improve testing `createLeaf`

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

Differential Revision: https://reviews.llvm.org/D87896
This commit is contained in:
Eduardo Caldas 2020-09-17 15:39:18 +00:00
parent aa769358d8
commit bb5b28f12f
1 changed files with 26 additions and 0 deletions

View File

@ -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());