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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameMethodProcessorTest.java

Issue 10381080: Support for renaming getters and setters (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: If no getter/setter, keep FieldElement Created 8 years, 7 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.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameMethodProcessorTest.java
diff --git a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameMethodProcessorTest.java b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameMethodProcessorTest.java
index a476ca6d872a9e0c41b7e1e59886355d7889b7e0..de71245d4f669cf414f735afca20ba6d44678260 100644
--- a/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameMethodProcessorTest.java
+++ b/editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameMethodProcessorTest.java
@@ -156,6 +156,36 @@ public final class RenameMethodProcessorTest extends RefactoringTest {
"}");
}
+ public void test_OK_getter() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " int get test() {",
+ " return 42;",
+ " }",
+ "}",
+ "f() {",
+ " A a = new A();",
+ " print(a.test);",
+ "}",
+ "");
+ Method method = findElement("test() {");
+ // do rename
+ renameMethod(method, "newName");
+ assertTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " int get newName() {",
+ " return 42;",
+ " }",
+ "}",
+ "f() {",
+ " A a = new A();",
+ " print(a.newName);",
+ "}",
+ "");
+ }
+
public void test_OK_multipleUnits_onReference() throws Exception {
setUnitContent(
"Test1.dart",
@@ -319,6 +349,34 @@ public final class RenameMethodProcessorTest extends RefactoringTest {
"");
}
+ public void test_OK_setter() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " void set test(x) {",
+ " }",
+ "}",
+ "f() {",
+ " A a = new A();",
+ " a.test = 42;",
+ "}",
+ "");
+ Method method = findElement("test = 42;");
+ // do rename
+ renameMethod(method, "newName");
+ assertTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "class A {",
+ " void set newName(x) {",
+ " }",
+ "}",
+ "f() {",
+ " A a = new A();",
+ " a.newName = 42;",
+ "}",
+ "");
+ }
+
public void test_OK_singleUnit_onDeclaration() throws Exception {
setTestUnitContent(
"// filler filler filler filler filler filler filler filler filler filler",
« no previous file with comments | « editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionProcessorTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698