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

Unified Diff: editor/tools/plugins/com.google.dart.tools.ui_test/src/com/google/dart/tools/ui/refactoring/RenameFunctionProcessorTest.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/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 b2fc89857e7a059e7117bd8c8a0d10d55981f4a2..0ee2df42edea9645f7c96c2b3a0859378edd1e04 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
@@ -127,6 +127,30 @@ 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() {",
+ " return 42;",
+ "}",
+ "f() {",
+ " print(test);",
+ "}",
+ "");
+ DartFunction function = findElement("test() {");
+ // do rename
+ renameFunction(function, "newName");
+ assertTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "int get newName() {",
+ " return 42;",
+ "}",
+ "f() {",
+ " print(newName);",
+ "}",
+ "");
+ }
+
public void test_OK_multipleUnits_onReference() throws Exception {
setUnitContent(
"Test1.dart",
@@ -164,6 +188,28 @@ public final class RenameFunctionProcessorTest extends RefactoringTest {
"}");
}
+ public void test_OK_setter() throws Exception {
+ setTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "void set test(x) {",
+ "}",
+ "f() {",
+ " test = 42;",
+ "}",
+ "");
+ DartFunction function = findElement("test = 42;");
+ // do rename
+ renameFunction(function, "newName");
+ assertTestUnitContent(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "void set newName(x) {",
+ "}",
+ "f() {",
+ " newName = 42;",
+ "}",
+ "");
+ }
+
public void test_OK_singleUnit_onDeclaration() throws Exception {
setTestUnitContent(
"// filler filler filler filler filler filler filler filler filler filler",

Powered by Google App Engine
This is Rietveld 408576698