]> granicus.if.org Git - clang/commitdiff
Adding tests since when I was asked whether this works I wasn't
authorManuel Klimek <klimek@google.com>
Mon, 10 Dec 2012 07:08:53 +0000 (07:08 +0000)
committerManuel Klimek <klimek@google.com>
Mon, 10 Dec 2012 07:08:53 +0000 (07:08 +0000)
100% sure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169725 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/ASTMatchers/ASTMatchersTest.cpp

index 8beff0f98a80d75ad3fa8a64c3cf90447625f10a..4fad5446aeaf2b8f674379ac74b03684372308a7 100644 (file)
@@ -80,6 +80,13 @@ TEST(NameableDeclaration, REMatchesVariousDecls) {
   EXPECT_TRUE(matches("int aFOObBARc;", Abc));
   EXPECT_TRUE(notMatches("int cab;", Abc));
   EXPECT_TRUE(matches("int cabc;", Abc));
+
+  DeclarationMatcher StartsWithK = namedDecl(matchesName(":k[^:]*$"));
+  EXPECT_TRUE(matches("int k;", StartsWithK));
+  EXPECT_TRUE(matches("int kAbc;", StartsWithK));
+  EXPECT_TRUE(matches("namespace x { int kTest; }", StartsWithK));
+  EXPECT_TRUE(matches("class C { int k; };", StartsWithK));
+  EXPECT_TRUE(notMatches("class C { int ckc; };", StartsWithK));
 }
 
 TEST(DeclarationMatcher, MatchClass) {