summaryrefslogtreecommitdiffstats
path: root/unittests/Tooling/RewriterTest.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-06-21 14:00:56 +0000
committerdim <dim@FreeBSD.org>2015-06-21 14:00:56 +0000
commit9dd834653b811ad20382e98a87dff824980c9916 (patch)
treea764184c2fc9486979b074250b013a0937ee64e5 /unittests/Tooling/RewriterTest.cpp
parentbb9760db9b86e93a638ed430d0a14785f7ff9064 (diff)
downloadFreeBSD-src-9dd834653b811ad20382e98a87dff824980c9916.zip
FreeBSD-src-9dd834653b811ad20382e98a87dff824980c9916.tar.gz
Vendor import of clang trunk r240225:
https://llvm.org/svn/llvm-project/cfe/trunk@240225
Diffstat (limited to 'unittests/Tooling/RewriterTest.cpp')
-rw-r--r--unittests/Tooling/RewriterTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/unittests/Tooling/RewriterTest.cpp b/unittests/Tooling/RewriterTest.cpp
index c53e50a..93f69eb 100644
--- a/unittests/Tooling/RewriterTest.cpp
+++ b/unittests/Tooling/RewriterTest.cpp
@@ -8,9 +8,12 @@
//===----------------------------------------------------------------------===//
#include "RewriterTestContext.h"
+#include "clang/Tooling/Core/Replacement.h"
#include "gtest/gtest.h"
namespace clang {
+namespace tooling {
+namespace {
TEST(Rewriter, OverwritesChangedFiles) {
RewriterTestContext Context;
@@ -34,4 +37,14 @@ TEST(Rewriter, ContinuesOverwritingFilesOnError) {
Context.getFileContentFromDisk("working.cpp"));
}
+TEST(Rewriter, AdjacentInsertAndDelete) {
+ Replacements Replaces;
+ Replaces.insert(Replacement("<file>", 6, 6, ""));
+ Replaces.insert(Replacement("<file>", 6, 0, "replaced\n"));
+ EXPECT_EQ("line1\nreplaced\nline3\nline4",
+ applyAllReplacements("line1\nline2\nline3\nline4", Replaces));
+}
+
+} // end namespace
+} // end namespace tooling
} // end namespace clang
OpenPOWER on IntegriCloud