From ef77f3cca73261c2c03d0b3586dba5bfeafb4920 Mon Sep 17 00:00:00 2001 From: Samuel Benzaquen Date: Fri, 22 Nov 2013 23:05:57 +0000 Subject: Make the negative test more specific. Summary: Make the negative test more specific. Otherwise it can accidentally match injected code. Reviewers: aaron.ballman CC: klimek, cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D2257 llvm-svn: 195512 --- clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp') diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp index dad9499ad4b..8694c642cd5 100644 --- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp +++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp @@ -296,16 +296,16 @@ TEST_F(RegistryTest, VariadicOp) { EXPECT_TRUE(matches("class Bar{};", D)); EXPECT_FALSE(matches("class OtherBar{};", D)); - D = constructMatcher( - "recordDecl", + D = recordDecl( + has(fieldDecl(hasName("Foo"))), constructMatcher( "unless", constructMatcher("namedDecl", - constructMatcher("hasName", std::string("Bar"))))) - .getTypedMatcher(); + constructMatcher("hasName", std::string("Bar")))) + .getTypedMatcher()); - EXPECT_FALSE(matches("class Bar{};", D)); - EXPECT_TRUE(matches("class OtherBar{};", D)); + EXPECT_FALSE(matches("class Bar{ int Foo; };", D)); + EXPECT_TRUE(matches("class OtherBar{ int Foo; };", D)); } TEST_F(RegistryTest, Errors) { -- cgit v1.2.3