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
This commit is contained in:
Samuel Benzaquen 2013-11-22 23:05:57 +00:00
parent 82e366e78f
commit ef77f3cca7
1 changed files with 6 additions and 6 deletions

View File

@ -296,16 +296,16 @@ TEST_F(RegistryTest, VariadicOp) {
EXPECT_TRUE(matches("class Bar{};", D)); EXPECT_TRUE(matches("class Bar{};", D));
EXPECT_FALSE(matches("class OtherBar{};", D)); EXPECT_FALSE(matches("class OtherBar{};", D));
D = constructMatcher( D = recordDecl(
"recordDecl", has(fieldDecl(hasName("Foo"))),
constructMatcher( constructMatcher(
"unless", "unless",
constructMatcher("namedDecl", constructMatcher("namedDecl",
constructMatcher("hasName", std::string("Bar"))))) constructMatcher("hasName", std::string("Bar"))))
.getTypedMatcher<Decl>(); .getTypedMatcher<Decl>());
EXPECT_FALSE(matches("class Bar{};", D)); EXPECT_FALSE(matches("class Bar{ int Foo; };", D));
EXPECT_TRUE(matches("class OtherBar{};", D)); EXPECT_TRUE(matches("class OtherBar{ int Foo; };", D));
} }
TEST_F(RegistryTest, Errors) { TEST_F(RegistryTest, Errors) {