diff options
author | Daniel Jasper <djasper@google.com> | 2013-04-08 16:44:05 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2013-04-08 16:44:05 +0000 |
commit | abe922342d67d4ffe05b366a5a2af972185272f8 (patch) | |
tree | 01f1c0d0c77d5df402bd60f77caf0184e9adc7f3 /unittests | |
parent | b3c881752b5decf2d71a1c008930ca3587a96041 (diff) |
Add matcher for NamespaceDecls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179027 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp index 301b4f7c8a..82f349fb0e 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -337,14 +337,22 @@ TEST(DeclarationMatcher, hasDeclContext) { " class D {};" " }" "}", - recordDecl(hasDeclContext(namedDecl(hasName("M")))))); + recordDecl(hasDeclContext(namespaceDecl(hasName("M")))))); EXPECT_TRUE(notMatches( "namespace N {" " namespace M {" " class D {};" " }" "}", - recordDecl(hasDeclContext(namedDecl(hasName("N")))))); + recordDecl(hasDeclContext(namespaceDecl(hasName("N")))))); + + EXPECT_TRUE(matches("namespace {" + " namespace M {" + " class D {};" + " }" + "}", + recordDecl(hasDeclContext(namespaceDecl( + hasName("M"), hasDeclContext(namespaceDecl())))))); } TEST(ClassTemplate, DoesNotMatchClass) { |