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

Side by Side Diff: pkg/analysis_server/test/services/refactoring/rename_import_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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/abstract_rename.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.refactoring.rename_import; 5 library test.services.refactoring.rename_import;
6 6
7 import 'package:analysis_server/src/services/correction/status.dart'; 7 import 'package:analysis_server/src/services/correction/status.dart';
8 import 'package:analysis_testing/reflective_tests.dart'; 8 import 'package:analysis_testing/reflective_tests.dart';
9 import 'package:analyzer/src/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // validate change 86 // validate change
87 return assertSuccessfulRename(''' 87 return assertSuccessfulRename('''
88 import 'dart:math' as test; 88 import 'dart:math' as test;
89 import 'dart:async' as newName; 89 import 'dart:async' as newName;
90 main() { 90 main() {
91 newName.Future f; 91 newName.Future f;
92 } 92 }
93 '''); 93 ''');
94 } 94 }
95 95
96 test_createChange_change_onPrefixElement() {
97 indexTestUnit('''
98 import 'dart:async' as test;
99 import 'dart:math' as test;
100 main() {
101 test.Future f;
102 test.PI;
103 test.E;
104 }
105 ''');
106 // configure refactoring
107 createRenameRefactoringAtString('test.PI');
108 expect(refactoring.refactoringName, 'Rename Import Prefix');
109 expect(refactoring.oldName, 'test');
110 refactoring.newName = 'newName';
111 // validate change
112 return assertSuccessfulRename('''
113 import 'dart:async' as test;
114 import 'dart:math' as newName;
115 main() {
116 test.Future f;
117 newName.PI;
118 newName.E;
119 }
120 ''');
121 }
122
96 test_createChange_change_function() { 123 test_createChange_change_function() {
97 indexTestUnit(''' 124 indexTestUnit('''
98 import 'dart:math' as test; 125 import 'dart:math' as test;
99 import 'dart:async' as test; 126 import 'dart:async' as test;
100 main() { 127 main() {
101 test.max(1, 2); 128 test.max(1, 2);
102 test.Future f; 129 test.Future f;
103 } 130 }
104 '''); 131 ''');
105 // configure refactoring 132 // configure refactoring
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 167 }
141 '''); 168 ''');
142 } 169 }
143 170
144 void _createRefactoring(String search) { 171 void _createRefactoring(String search) {
145 ImportDirective directive = 172 ImportDirective directive =
146 findNodeAtString(search, (node) => node is ImportDirective); 173 findNodeAtString(search, (node) => node is ImportDirective);
147 createRenameRefactoringForElement(directive.element); 174 createRenameRefactoringForElement(directive.element);
148 } 175 }
149 } 176 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/abstract_rename.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698