| 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",
|
|
|