[cfe-commits] r157812 - /cfe/trunk/unittests/Tooling/ToolingTest.cpp
Alexander Kornienko
alexfh at google.com
Fri Jun 1 07:50:43 PDT 2012
Author: alexfh
Date: Fri Jun 1 09:50:43 2012
New Revision: 157812
URL: http://llvm.org/viewvc/llvm-project?rev=157812&view=rev
Log:
Added a test for ToolInvocation::mapVirtualFile method.
Modified:
cfe/trunk/unittests/Tooling/ToolingTest.cpp
Modified: cfe/trunk/unittests/Tooling/ToolingTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/ToolingTest.cpp?rev=157812&r1=157811&r2=157812&view=diff
==============================================================================
--- cfe/trunk/unittests/Tooling/ToolingTest.cpp (original)
+++ cfe/trunk/unittests/Tooling/ToolingTest.cpp Fri Jun 1 09:50:43 2012
@@ -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 @@
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
More information about the cfe-commits
mailing list