| Index: editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionProcessorTest.java
|
| diff --git a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionProcessorTest.java b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionProcessorTest.java
|
| index b8f2eb4363e7463d8114f810e7ec3f93c1c074e3..b87c07f55e7f152f129e6541087b0f6d87a1f787 100644
|
| --- a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionProcessorTest.java
|
| +++ b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionProcessorTest.java
|
| @@ -37,6 +37,32 @@ public final class RenameFunctionProcessorTest extends RefactoringTest {
|
| renameSupport.perform(workbenchWindow.getShell(), workbenchWindow);
|
| }
|
|
|
| + private void check_postCondition_topLevel(String shadowName) throws Exception {
|
| + check_postCondition_topLevel("Test.dart", shadowName);
|
| + }
|
| +
|
| + private void check_postCondition_topLevel(String unitName, String shadowName) throws Exception {
|
| + DartFunction function = findElement("test() {");
|
| + // try to rename
|
| + String source = testUnit.getSource();
|
| + try {
|
| + renameFunction(function, "newName");
|
| + fail();
|
| + } catch (InterruptedException e) {
|
| + }
|
| + // error should be displayed
|
| + assertThat(openInformationMessages).isEmpty();
|
| + assertEquals(RefactoringStatus.ERROR, showStatusSeverities.get(0).intValue());
|
| + assertThat(showStatusMessages).hasSize(1);
|
| + assertEquals("File 'Test/"
|
| + + unitName
|
| + + "' in library 'Test' already declares top-level "
|
| + + shadowName
|
| + + " 'newName'", showStatusMessages.get(0));
|
| + // no source changes
|
| + assertEquals(source, testUnit.getSource());
|
| + }
|
| +
|
| /**
|
| * Just for coverage of {@link RenameFunctionProcessor} accessors.
|
| */
|
| @@ -128,19 +154,19 @@ public final class RenameFunctionProcessorTest extends RefactoringTest {
|
| public void test_OK_getter() throws Exception {
|
| setTestUnitContent(
|
| "// filler filler filler filler filler filler filler filler filler filler",
|
| - "int get test() {",
|
| + "int get test {",
|
| " return 42;",
|
| "}",
|
| "f() {",
|
| " print(test);",
|
| "}",
|
| "");
|
| - DartFunction function = findElement("test() {");
|
| + DartFunction function = findElement("test {");
|
| // do rename
|
| renameFunction(function, "newName");
|
| assertTestUnitContent(
|
| "// filler filler filler filler filler filler filler filler filler filler",
|
| - "int get newName() {",
|
| + "int get newName {",
|
| " return 42;",
|
| "}",
|
| "f() {",
|
| @@ -567,30 +593,4 @@ public final class RenameFunctionProcessorTest extends RefactoringTest {
|
| "}",
|
| "somethingBad");
|
| }
|
| -
|
| - private void check_postCondition_topLevel(String shadowName) throws Exception {
|
| - check_postCondition_topLevel("Test.dart", shadowName);
|
| - }
|
| -
|
| - private void check_postCondition_topLevel(String unitName, String shadowName) throws Exception {
|
| - DartFunction function = findElement("test() {");
|
| - // try to rename
|
| - String source = testUnit.getSource();
|
| - try {
|
| - renameFunction(function, "newName");
|
| - fail();
|
| - } catch (InterruptedException e) {
|
| - }
|
| - // error should be displayed
|
| - assertThat(openInformationMessages).isEmpty();
|
| - assertEquals(RefactoringStatus.ERROR, showStatusSeverities.get(0).intValue());
|
| - assertThat(showStatusMessages).hasSize(1);
|
| - assertEquals("File 'Test/"
|
| - + unitName
|
| - + "' in library 'Test' already declares top-level "
|
| - + shadowName
|
| - + " 'newName'", showStatusMessages.get(0));
|
| - // no source changes
|
| - assertEquals(source, testUnit.getSource());
|
| - }
|
| }
|
|
|