summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Tooling/RefactoringTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Tooling/RefactoringTest.cpp')
-rw-r--r--clang/unittests/Tooling/RefactoringTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/unittests/Tooling/RefactoringTest.cpp b/clang/unittests/Tooling/RefactoringTest.cpp
index d9f023d9653..81f9f040aeb 100644
--- a/clang/unittests/Tooling/RefactoringTest.cpp
+++ b/clang/unittests/Tooling/RefactoringTest.cpp
@@ -120,6 +120,21 @@ TEST_F(ReplacementTest, CanApplyReplacements) {
EXPECT_EQ("line1\nreplaced\nother\nline4", Context.getRewrittenText(ID));
}
+// FIXME: Remove this test case when Replacements is implemented as std::vector
+// instead of std::set. The other ReplacementTest tests will need to be updated
+// at that point as well.
+TEST_F(ReplacementTest, VectorCanApplyReplacements) {
+ FileID ID = Context.createInMemoryFile("input.cpp",
+ "line1\nline2\nline3\nline4");
+ std::vector<Replacement> Replaces;
+ Replaces.push_back(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
+ 5, "replaced"));
+ Replaces.push_back(
+ Replacement(Context.Sources, Context.getLocation(ID, 3, 1), 5, "other"));
+ EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
+ EXPECT_EQ("line1\nreplaced\nother\nline4", Context.getRewrittenText(ID));
+}
+
TEST_F(ReplacementTest, SkipsDuplicateReplacements) {
FileID ID = Context.createInMemoryFile("input.cpp",
"line1\nline2\nline3\nline4");
OpenPOWER on IntegriCloud