mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-05 23:52:45 +00:00
[Tooling] Test more APIs of ToolExecutor. NFC.
llvm-svn: 323517
This commit is contained in:
parent
6e1dc68117
commit
2a27ebe670
@ -46,7 +46,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TraverseFunctionDecl(clang::FunctionDecl *Decl) {
|
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);
|
return ASTVisitor::TraverseFunctionDecl(Decl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -213,10 +216,12 @@ TEST(StandaloneToolTest, SimpleActionWithResult) {
|
|||||||
auto KVs = Executor.getToolResults()->AllKVResults();
|
auto KVs = Executor.getToolResults()->AllKVResults();
|
||||||
ASSERT_EQ(KVs.size(), 1u);
|
ASSERT_EQ(KVs.size(), 1u);
|
||||||
EXPECT_EQ("f", KVs[0].first);
|
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(
|
Executor.getToolResults()->forEachResult(
|
||||||
[](StringRef, StringRef Value) { EXPECT_EQ("1", Value); });
|
[](StringRef, StringRef Value) { EXPECT_EQ("::/1", Value); });
|
||||||
}
|
}
|
||||||
|
|
||||||
class FixedCompilationDatabaseWithFiles : public CompilationDatabase {
|
class FixedCompilationDatabaseWithFiles : public CompilationDatabase {
|
||||||
|
Loading…
Reference in New Issue
Block a user