diff options
| author | Alexander Kornienko <alexfh@google.com> | 2012-06-01 14:50:43 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2012-06-01 14:50:43 +0000 |
| commit | 55f2ca9b27d383e628e38e4f61ce2a8269fe2d07 (patch) | |
| tree | ccc72c5455ed46751d245e8db878eee7b1ef5050 /clang/unittests/Tooling/ToolingTest.cpp | |
| parent | bd7303b7f747f3299b3ea30228702c61e7f416d1 (diff) | |
| download | bcm5719-llvm-55f2ca9b27d383e628e38e4f61ce2a8269fe2d07.tar.gz bcm5719-llvm-55f2ca9b27d383e628e38e4f61ce2a8269fe2d07.zip | |
Added a test for ToolInvocation::mapVirtualFile method.
llvm-svn: 157812
Diffstat (limited to 'clang/unittests/Tooling/ToolingTest.cpp')
| -rw-r--r-- | clang/unittests/Tooling/ToolingTest.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/ToolingTest.cpp b/clang/unittests/Tooling/ToolingTest.cpp index c7b2210a754..9122786b553 100644 --- a/clang/unittests/Tooling/ToolingTest.cpp +++ b/clang/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 |

