From 059c1d8e7224667e74fe8a1280411732f88f0a70 Mon Sep 17 00:00:00 2001 From: Gabor Marton Date: Mon, 28 Jan 2019 10:01:11 +0000 Subject: [PATCH] [AST] Add structural eq tests for template args Summary: New tests added to verify equivalency of templates when their parameters are different. Reviewers: a_sidorin, shafik Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D57235 llvm-svn: 352345 --- clang/unittests/AST/StructuralEquivalenceTest.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/clang/unittests/AST/StructuralEquivalenceTest.cpp b/clang/unittests/AST/StructuralEquivalenceTest.cpp index 919856f..e6c289a 100644 --- a/clang/unittests/AST/StructuralEquivalenceTest.cpp +++ b/clang/unittests/AST/StructuralEquivalenceTest.cpp @@ -802,6 +802,25 @@ TEST_F(StructuralEquivalenceEnumTest, EnumsWithDifferentBody) { EXPECT_FALSE(testStructuralMatch(t)); } +struct StructuralEquivalenceTemplateTest : StructuralEquivalenceTest {}; + +TEST_F(StructuralEquivalenceTemplateTest, ExactlySameTemplates) { + auto t = makeNamedDecls("template struct foo;", + "template struct foo;", Lang_CXX); + EXPECT_TRUE(testStructuralMatch(t)); +} + +TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgName) { + auto t = makeNamedDecls("template struct foo;", + "template struct foo;", Lang_CXX); + EXPECT_TRUE(testStructuralMatch(t)); +} + +TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgKind) { + auto t = makeNamedDecls("template struct foo;", + "template struct foo;", Lang_CXX); + EXPECT_FALSE(testStructuralMatch(t)); +} } // end namespace ast_matchers } // end namespace clang -- 2.7.4