forked from OSchip/llvm-project
Added a test for ToolInvocation::mapVirtualFile method.
llvm-svn: 157812
This commit is contained in:
parent
bd7303b7f7
commit
55f2ca9b27
|
@ -15,6 +15,7 @@
|
|||
#include "clang/Tooling/CompilationDatabase.h"
|
||||
#include "clang/Tooling/Tooling.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <string>
|
||||
|
||||
namespace clang {
|
||||
namespace tooling {
|
||||
|
@ -109,5 +110,18 @@ TEST(newFrontendActionFactory, CreatesFrontendActionFactoryFromFactoryType) {
|
|||
EXPECT_TRUE(Action.get() != NULL);
|
||||
}
|
||||
|
||||
TEST(ToolInvocation, TestMapVirtualFile) {
|
||||
clang::FileManager Files((clang::FileSystemOptions()));
|
||||
std::vector<std::string> Args;
|
||||
Args.push_back("tool-executable");
|
||||
Args.push_back("-Idef");
|
||||
Args.push_back("-fsyntax-only");
|
||||
Args.push_back("test.cpp");
|
||||
clang::tooling::ToolInvocation Invocation(Args, new SyntaxOnlyAction, &Files);
|
||||
Invocation.mapVirtualFile("test.cpp", "#include <abc>\n");
|
||||
Invocation.mapVirtualFile("def/abc", "\n");
|
||||
EXPECT_TRUE(Invocation.run());
|
||||
}
|
||||
|
||||
} // end namespace tooling
|
||||
} // end namespace clang
|
||||
|
|
Loading…
Reference in New Issue