aboutsummaryrefslogtreecommitdiff
path: root/unittests/ASTMatchers/ASTMatchersTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2012-12-04 11:54:27 +0000
committerDaniel Jasper <djasper@google.com>2012-12-04 11:54:27 +0000
commit36e29d6732814e958aea4b2f403cec63d7ed3116 (patch)
tree7bad25891ebd2cf1b2c816ce44d0b3737f6ae67e /unittests/ASTMatchers/ASTMatchersTest.cpp
parenta88bb45f11c1e27f9caf60a85a8e1774d3e09ead (diff)
Add parameterCountIs() matcher.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169257 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/ASTMatchersTest.cpp')
-rw-r--r--unittests/ASTMatchers/ASTMatchersTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp
index ad072aa7ce..f3d377b771 100644
--- a/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1238,6 +1238,14 @@ TEST(Matcher, ArgumentCount) {
EXPECT_TRUE(notMatches("void x(int, int) { x(0, 0); }", Call1Arg));
}
+TEST(Matcher, ParameterCount) {
+ DeclarationMatcher Function1Arg = functionDecl(parameterCountIs(1));
+ EXPECT_TRUE(matches("void f(int i) {}", Function1Arg));
+ EXPECT_TRUE(matches("class X { void f(int i) {} };", Function1Arg));
+ EXPECT_TRUE(notMatches("void f() {}", Function1Arg));
+ EXPECT_TRUE(notMatches("void f(int i, int j, int k) {}", Function1Arg));
+}
+
TEST(Matcher, References) {
DeclarationMatcher ReferenceClassX = varDecl(
hasType(references(recordDecl(hasName("X")))));