From e792efd7baa2d270cda50d97e2714f47f775983b Mon Sep 17 00:00:00 2001 From: Manuel Klimek Date: Mon, 10 Dec 2012 07:08:53 +0000 Subject: [PATCH] Adding tests since when I was asked whether this works I wasn't 100% sure. llvm-svn: 169725 --- clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index 8beff0f98a80..4fad5446aeaf 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -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) {