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

Unified Diff: pkg/analysis_server/test/edit/refactoring_test.dart

Issue 481173002: When user renames 'prefix' in 'prefix.Class' she actually wants to rename ImportElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Tweak for test - reference ambiguous prefix name. Created 6 years, 4 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: pkg/analysis_server/test/edit/refactoring_test.dart
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index f5b1a893f0efac49640c48d367f83dad0bf43710..8db3bcc3511214ea835be8eb4692169e09ace461 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -23,6 +23,9 @@ main() {
@ReflectiveTestCase()
class GetAvailableRefactoringsTest extends AbstractAnalysisTest {
+ /**
+ * Tests that there is a RENAME refactoring available at the [search] offset.
+ */
Future assertHasRenameRefactoring(String code, String search) {
addTestFile(code);
return waitForTasksFinished().then((_) {
@@ -31,6 +34,10 @@ class GetAvailableRefactoringsTest extends AbstractAnalysisTest {
});
}
+ /**
+ * Returns the list of available refactorings of the offset of [search] with
+ * [length] characters selected.
+ */
List<String> getAvailableRefactorings(String search, [int length = 0]) {
Request request = new Request('0', EDIT_GET_AVAILABLE_REFACTORINGS);
request.setParameter(FILE, testFile);
@@ -85,6 +92,25 @@ main() {
''', 'import ');
}
+ Future test_rename_hasElement_importElement_prefixDecl() {
+ return assertHasRenameRefactoring('''
+import 'dart:math' as math;
+main() {
+ math.PI;
+}
+''', 'math;');
+ }
+
+ Future test_rename_hasElement_importElement_prefixRef() {
+ return assertHasRenameRefactoring('''
+import 'dart:async' as test;
+import 'dart:math' as test;
+main() {
+ test.PI;
+}
+''', 'test.PI;');
+ }
+
Future test_rename_hasElement_instanceGetter() {
return assertHasRenameRefactoring('''
class A {

Powered by Google App Engine
This is Rietveld 408576698