diff options
Diffstat (limited to 'clang/unittests/ASTMatchers')
-rw-r--r-- | clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index a759df9070f..6eb552aa564 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -832,6 +832,12 @@ TEST(HasDeclaration, HasDeclarationOfTypeWithDecl) { // FIXME: Add tests for other types with getDecl() (e.g. RecordType) } +TEST(HasDeclaration, HasDeclarationOfTemplateSpecializationType) { + EXPECT_TRUE(matches("template <typename T> class A {}; A<int> a;", + varDecl(hasType(templateSpecializationType( + hasDeclaration(namedDecl(hasName("A")))))))); +} + TEST(HasType, TakesQualTypeMatcherAndMatchesExpr) { TypeMatcher ClassX = hasDeclaration(recordDecl(hasName("X"))); EXPECT_TRUE( @@ -3406,6 +3412,11 @@ TEST(TypeMatching, MatchesTypedefTypes) { hasType(typedefType())))); } +TEST(TypeMatching, MatchesTemplateSpecializationType) { + EXPECT_TRUE(matches("template <typename T> class A{}; A<int>a;", + templateSpecializationType())); +} + TEST(NNS, MatchesNestedNameSpecifiers) { EXPECT_TRUE(matches("namespace ns { struct A {}; } ns::A a;", nestedNameSpecifier())); |