Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/internal/refactoring/RenameLocalRefactoringImplTest.java

Issue 23498016: Update only unique references during rename refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/internal/refactoring/RenameLocalRefactoringImplTest.java
diff --git a/editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/internal/refactoring/RenameLocalRefactoringImplTest.java b/editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/internal/refactoring/RenameLocalRefactoringImplTest.java
index 9a8a3f8d57f22bfb328d12ab28db435beb29ab63..829b16d05fe1cdc33347b498c00471134e7f23cc 100644
--- a/editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/internal/refactoring/RenameLocalRefactoringImplTest.java
+++ b/editor/tools/plugins/com.google.dart.engine.services_test/src/com/google/dart/engine/services/internal/refactoring/RenameLocalRefactoringImplTest.java
@@ -14,7 +14,9 @@
package com.google.dart.engine.services.internal.refactoring;
+import com.google.dart.engine.ast.CompilationUnit;
import com.google.dart.engine.services.status.RefactoringStatusSeverity;
+import com.google.dart.engine.source.Source;
/**
* Test for {@link RenameLocalRefactoringImpl}.
@@ -384,6 +386,35 @@ public class RenameLocalRefactoringImplTest extends RenameRefactoringImplTest {
"}");
}
+ public void test_createChange_oneUnitInTwoContexts() throws Exception {
+ String code = makeSource(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " int test = 0;",
+ " print(test);",
+ "}");
+ // index unit in separate context
+ {
+ ContextHelper helper = new ContextHelper();
+ Source source = helper.addSource("/Test.dart", code);
+ CompilationUnit unit = helper.analyzeSingleUnitLibrary(source);
+ index.indexUnit(helper.context, unit);
+ }
+ // index same unit as "test"
+ indexTestUnit(code);
+ // configure refactoring
+ createRenameRefactoring("test = 0");
+ assertEquals("Rename Local Variable", refactoring.getRefactoringName());
+ refactoring.setNewName("newName");
+ // validate change
+ assertSuccessfulRename(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "main() {",
+ " int newName = 0;",
+ " print(newName);",
+ "}");
+ }
+
public void test_createChange_parameter() throws Exception {
indexTestUnit(
"// filler filler filler filler filler filler filler filler filler filler",

Powered by Google App Engine
This is Rietveld 408576698