[PATCH] Fix tests to be more specific.
Samuel Benzaquen
sbenza at google.com
Wed Aug 28 15:11:12 PDT 2013
Fixed the tests.
Hi aaron.ballman,
http://llvm-reviews.chandlerc.com/D1541
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D1541?vs=3875&id=3876#toc
Files:
unittests/ASTMatchers/Dynamic/RegistryTest.cpp
Index: unittests/ASTMatchers/Dynamic/RegistryTest.cpp
===================================================================
--- unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -169,22 +169,16 @@
EXPECT_FALSE(matches("void f();", Func));
Matcher<Decl> Anything = constructMatcher("anything").getTypedMatcher<Decl>();
- Matcher<Decl> RecordDecl =
- constructMatcher("recordDecl", VariantMatcher::SingleMatcher(Anything))
- .getTypedMatcher<Decl>();
-
- EXPECT_TRUE(matches("int a;", Anything));
- EXPECT_TRUE(matches("class A {};", Anything));
- EXPECT_TRUE(matches("void f(){};", Anything));
- // FIXME: A couple of tests have been suppressed.
- // I know it'd be bad with _MSC_VER here, though.
-#if !defined(_MSC_VER)
- EXPECT_FALSE(matches("int a;", RecordDecl));
-#endif
- EXPECT_TRUE(matches("class A {};", RecordDecl));
-#if !defined(_MSC_VER)
- EXPECT_FALSE(matches("void f(){};", RecordDecl));
-#endif
+ Matcher<Decl> RecordDecl = constructMatcher(
+ "recordDecl", constructMatcher("hasName", std::string("Foo")),
+ VariantMatcher::SingleMatcher(Anything)).getTypedMatcher<Decl>();
+
+ EXPECT_TRUE(matches("int Foo;", Anything));
+ EXPECT_TRUE(matches("class Foo {};", Anything));
+ EXPECT_TRUE(matches("void Foo(){};", Anything));
+ EXPECT_FALSE(matches("int Foo;", RecordDecl));
+ EXPECT_TRUE(matches("class Foo {};", RecordDecl));
+ EXPECT_FALSE(matches("void Foo(){};", RecordDecl));
}
TEST_F(RegistryTest, TemplateArgument) {
@@ -263,7 +257,9 @@
TEST_F(RegistryTest, VariadicOp) {
Matcher<Decl> D = constructMatcher(
- "anyOf", constructMatcher("recordDecl"),
+ "anyOf",
+ constructMatcher("recordDecl",
+ constructMatcher("hasName", std::string("Foo"))),
constructMatcher("namedDecl",
constructMatcher("hasName", std::string("foo"))))
.getTypedMatcher<Decl>();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1541.2.patch
Type: text/x-patch
Size: 1958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130828/68ca0bc8/attachment.bin>
More information about the cfe-commits
mailing list