aboutsummaryrefslogtreecommitdiff
path: root/unittests/Tooling/ToolingTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2012-06-01 14:50:43 +0000
committerAlexander Kornienko <alexfh@google.com>2012-06-01 14:50:43 +0000
commit5f60f606093019174a11fcfd3ae36634dc44e8c9 (patch)
tree909076b82d64d7072e31dffdbca012c45043d7c3 /unittests/Tooling/ToolingTest.cpp
parent5a2eff85d185ad94b6272a6f6c869496d8c23ced (diff)
Added a test for ToolInvocation::mapVirtualFile method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157812 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Tooling/ToolingTest.cpp')
-rw-r--r--unittests/Tooling/ToolingTest.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/unittests/Tooling/ToolingTest.cpp b/unittests/Tooling/ToolingTest.cpp
index c7b2210a75..9122786b55 100644
--- a/unittests/Tooling/ToolingTest.cpp
+++ b/unittests/Tooling/ToolingTest.cpp
@@ -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