aboutsummaryrefslogtreecommitdiff
path: root/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--unittests/ASTMatchers/ASTMatchersTest.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp
index 597cf6fe4d..5791932b17 100644
--- a/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -245,7 +245,7 @@ TEST(DeclarationMatcher, ClassIsDerived) {
variable(
hasName("z_char"),
hasInitializer(hasType(record(isDerivedFrom("Base1"),
- isDerivedFrom("Base2")))))));
+ isDerivedFrom("Base2")))))));
const char *RecursiveTemplateTwoParameters =
"class Base1 {}; class Base2 {};"
@@ -273,7 +273,17 @@ TEST(DeclarationMatcher, ClassIsDerived) {
variable(
hasName("z_char"),
hasInitializer(hasType(record(isDerivedFrom("Base1"),
- isDerivedFrom("Base2")))))));
+ isDerivedFrom("Base2")))))));
+ EXPECT_TRUE(matches(
+ "namespace ns { class X {}; class Y : public X {}; }",
+ record(isDerivedFrom("::ns::X"))));
+ EXPECT_TRUE(notMatches(
+ "class X {}; class Y : public X {};",
+ record(isDerivedFrom("::ns::X"))));
+
+ EXPECT_TRUE(matches(
+ "class X {}; class Y : public X {};",
+ record(isDerivedFrom(id("test", record(hasName("X")))))));
}
TEST(AllOf, AllOverloadsWork) {