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

Side by Side Diff: pkg/analysis_server/test/services/refactoring/rename_constructor_test.dart

Issue 545943003: Include additional information into RenameFeedback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 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
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_constructor; 5 library test.services.refactoring.rename_constructor;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import '../../reflective_tests.dart'; 8 import '../../reflective_tests.dart';
9 import 'package:analyzer/src/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 B() : super() {} 96 B() : super() {}
97 factory B._() = A; 97 factory B._() = A;
98 } 98 }
99 main() { 99 main() {
100 new A(); 100 new A();
101 } 101 }
102 '''); 102 ''');
103 // configure refactoring 103 // configure refactoring
104 _createConstructorDeclarationRefactoring('() {} // marker'); 104 _createConstructorDeclarationRefactoring('() {} // marker');
105 expect(refactoring.refactoringName, 'Rename Constructor'); 105 expect(refactoring.refactoringName, 'Rename Constructor');
106 expect(refactoring.elementKindName, 'constructor');
106 expect(refactoring.oldName, ''); 107 expect(refactoring.oldName, '');
107 // validate change 108 // validate change
108 refactoring.newName = 'newName'; 109 refactoring.newName = 'newName';
109 return assertSuccessfulRefactoring(''' 110 return assertSuccessfulRefactoring('''
110 class A { 111 class A {
111 A.newName() {} // marker 112 A.newName() {} // marker
112 } 113 }
113 class B extends A { 114 class B extends A {
114 B() : super.newName() {} 115 B() : super.newName() {}
115 factory B._() = A.newName; 116 factory B._() = A.newName;
(...skipping 13 matching lines...) Expand all
129 B() : super.test() {} 130 B() : super.test() {}
130 factory B._() = A.test; 131 factory B._() = A.test;
131 } 132 }
132 main() { 133 main() {
133 new A.test(); 134 new A.test();
134 } 135 }
135 '''); 136 ''');
136 // configure refactoring 137 // configure refactoring
137 _createConstructorDeclarationRefactoring('test() {} // marker'); 138 _createConstructorDeclarationRefactoring('test() {} // marker');
138 expect(refactoring.refactoringName, 'Rename Constructor'); 139 expect(refactoring.refactoringName, 'Rename Constructor');
140 expect(refactoring.elementKindName, 'constructor');
139 expect(refactoring.oldName, 'test'); 141 expect(refactoring.oldName, 'test');
140 // validate change 142 // validate change
141 refactoring.newName = 'newName'; 143 refactoring.newName = 'newName';
142 return assertSuccessfulRefactoring(''' 144 return assertSuccessfulRefactoring('''
143 class A { 145 class A {
144 A.newName() {} // marker 146 A.newName() {} // marker
145 } 147 }
146 class B extends A { 148 class B extends A {
147 B() : super.newName() {} 149 B() : super.newName() {}
148 factory B._() = A.newName; 150 factory B._() = A.newName;
(...skipping 13 matching lines...) Expand all
162 B() : super.test() {} 164 B() : super.test() {}
163 factory B._() = A.test; 165 factory B._() = A.test;
164 } 166 }
165 main() { 167 main() {
166 new A.test(); 168 new A.test();
167 } 169 }
168 '''); 170 ''');
169 // configure refactoring 171 // configure refactoring
170 _createConstructorDeclarationRefactoring('test() {} // marker'); 172 _createConstructorDeclarationRefactoring('test() {} // marker');
171 expect(refactoring.refactoringName, 'Rename Constructor'); 173 expect(refactoring.refactoringName, 'Rename Constructor');
174 expect(refactoring.elementKindName, 'constructor');
172 expect(refactoring.oldName, 'test'); 175 expect(refactoring.oldName, 'test');
173 // validate change 176 // validate change
174 refactoring.newName = ''; 177 refactoring.newName = '';
175 return assertSuccessfulRefactoring(''' 178 return assertSuccessfulRefactoring('''
176 class A { 179 class A {
177 A() {} // marker 180 A() {} // marker
178 } 181 }
179 class B extends A { 182 class B extends A {
180 B() : super() {} 183 B() : super() {}
181 factory B._() = A; 184 factory B._() = A;
182 } 185 }
183 main() { 186 main() {
184 new A(); 187 new A();
185 } 188 }
186 '''); 189 ''');
187 } 190 }
188 191
189 void _createConstructorDeclarationRefactoring(String search) { 192 void _createConstructorDeclarationRefactoring(String search) {
190 ConstructorElement element = 193 ConstructorElement element =
191 findNodeElementAtString(search, (node) => node is ConstructorDeclaration ); 194 findNodeElementAtString(search, (node) => node is ConstructorDeclaration );
192 createRenameRefactoringForElement(element); 195 createRenameRefactoringForElement(element);
193 } 196 }
194 } 197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698