[cfe-commits] r169725 - /cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Manuel Klimek klimek at google.com
Sun Dec 9 23:08:53 PST 2012


Author: klimek
Date: Mon Dec 10 01:08:53 2012
New Revision: 169725

URL: http://llvm.org/viewvc/llvm-project?rev=169725&view=rev
Log:
Adding tests since when I was asked whether this works I wasn't
100% sure.

Modified:
    cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=169725&r1=169724&r2=169725&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Mon Dec 10 01:08:53 2012
@@ -80,6 +80,13 @@
   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) {





More information about the cfe-commits mailing list