]> granicus.if.org Git - clang/commitdiff
[Tooling] Test more APIs of ToolExecutor. NFC.
authorEric Liu <ioeric@google.com>
Fri, 26 Jan 2018 11:10:32 +0000 (11:10 +0000)
committerEric Liu <ioeric@google.com>
Fri, 26 Jan 2018 11:10:32 +0000 (11:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323517 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Tooling/ExecutionTest.cpp

index 68c4bf25c914a14c6972c973dc179c072fe17471..26db8c6d0ea85da8e8b9c96e0d37e6ae023d61fc 100644 (file)
@@ -46,7 +46,10 @@ public:
   }
 
   bool TraverseFunctionDecl(clang::FunctionDecl *Decl) {
-    Context->reportResult(Decl->getNameAsString(), "1");
+    Context->reportResult(Decl->getNameAsString(),
+                          Context->getRevision() + ":" + Context->getCorpus() +
+                              ":" + Context->getCurrentCompilationUnit() +
+                              "/1");
     return ASTVisitor::TraverseFunctionDecl(Decl);
   }
 
@@ -213,10 +216,12 @@ TEST(StandaloneToolTest, SimpleActionWithResult) {
   auto KVs = Executor.getToolResults()->AllKVResults();
   ASSERT_EQ(KVs.size(), 1u);
   EXPECT_EQ("f", KVs[0].first);
-  EXPECT_EQ("1", KVs[0].second);
+  // Currently the standlone executor returns empty corpus, revision, and
+  // compilation unit.
+  EXPECT_EQ("::/1", KVs[0].second);
 
   Executor.getToolResults()->forEachResult(
-      [](StringRef, StringRef Value) { EXPECT_EQ("1", Value); });
+      [](StringRef, StringRef Value) { EXPECT_EQ("::/1", Value); });
 }
 
 class FixedCompilationDatabaseWithFiles : public CompilationDatabase {