summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clang-query/QueryEngineTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/unittests/clang-query/QueryEngineTest.cpp')
-rw-r--r--clang-tools-extra/unittests/clang-query/QueryEngineTest.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/clang-tools-extra/unittests/clang-query/QueryEngineTest.cpp b/clang-tools-extra/unittests/clang-query/QueryEngineTest.cpp
index f95d315c61b..74fd6d1a3f4 100644
--- a/clang-tools-extra/unittests/clang-query/QueryEngineTest.cpp
+++ b/clang-tools-extra/unittests/clang-query/QueryEngineTest.cpp
@@ -52,6 +52,8 @@ TEST_F(QueryEngineTest, Basic) {
DynTypedMatcher FnMatcher = functionDecl();
DynTypedMatcher FooMatcher = functionDecl(hasName("foo1"));
+ std::string FooMatcherString = "functionDecl(hasName(\"foo1\"))";
+
EXPECT_TRUE(NoOpQuery().run(OS, S));
EXPECT_EQ("", OS.str());
@@ -70,7 +72,7 @@ TEST_F(QueryEngineTest, Basic) {
Str.clear();
- EXPECT_TRUE(MatchQuery(FnMatcher).run(OS, S));
+ EXPECT_TRUE(MatchQuery("functionDecl()", FnMatcher).run(OS, S));
EXPECT_TRUE(OS.str().find("foo.cc:1:1: note: \"root\" binds here") !=
std::string::npos);
@@ -84,7 +86,7 @@ TEST_F(QueryEngineTest, Basic) {
Str.clear();
- EXPECT_TRUE(MatchQuery(FooMatcher).run(OS, S));
+ EXPECT_TRUE(MatchQuery(FooMatcherString, FooMatcher).run(OS, S));
EXPECT_TRUE(OS.str().find("foo.cc:1:1: note: \"root\" binds here") !=
std::string::npos);
@@ -94,7 +96,7 @@ TEST_F(QueryEngineTest, Basic) {
EXPECT_TRUE(
SetQuery<OutputKind>(&QuerySession::OutKind, OK_Print).run(OS, S));
- EXPECT_TRUE(MatchQuery(FooMatcher).run(OS, S));
+ EXPECT_TRUE(MatchQuery(FooMatcherString, FooMatcher).run(OS, S));
EXPECT_TRUE(OS.str().find("Binding for \"root\":\nvoid foo1()") !=
std::string::npos);
@@ -102,20 +104,20 @@ TEST_F(QueryEngineTest, Basic) {
Str.clear();
EXPECT_TRUE(SetQuery<OutputKind>(&QuerySession::OutKind, OK_Dump).run(OS, S));
- EXPECT_TRUE(MatchQuery(FooMatcher).run(OS, S));
+ EXPECT_TRUE(MatchQuery(FooMatcherString, FooMatcher).run(OS, S));
EXPECT_TRUE(OS.str().find("FunctionDecl") != std::string::npos);
Str.clear();
EXPECT_TRUE(SetQuery<bool>(&QuerySession::BindRoot, false).run(OS, S));
- EXPECT_TRUE(MatchQuery(FooMatcher).run(OS, S));
+ EXPECT_TRUE(MatchQuery(FooMatcherString, FooMatcher).run(OS, S));
EXPECT_TRUE(OS.str().find("No bindings.") != std::string::npos);
Str.clear();
- EXPECT_FALSE(MatchQuery(isMain()).run(OS, S));
+ EXPECT_FALSE(MatchQuery("isMain()", isMain()).run(OS, S));
EXPECT_EQ("Not a valid top-level matcher.\n", OS.str());
}
OpenPOWER on IntegriCloud