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

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

Issue 547343004: Send feedback for the INLINE_LOCAL_VARIABLE refactoring. (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
« no previous file with comments | « pkg/analysis_server/test/edit/refactoring_test.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.inline_local; 5 library test.services.refactoring.inline_local;
6 6
7 import 'package:analysis_server/src/protocol.dart' hide Element; 7 import 'package:analysis_server/src/protocol.dart' hide Element;
8 import 'package:analysis_server/src/services/correction/status.dart'; 8 import 'package:analysis_server/src/services/correction/status.dart';
9 import 'package:analysis_server/src/services/refactoring/inline_local.dart'; 9 import 'package:analysis_server/src/services/refactoring/inline_local.dart';
10 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 main() { 187 main() {
188 int test = 1 + 2; 188 int test = 1 + 2;
189 print(test); 189 print(test);
190 print(test); 190 print(test);
191 } 191 }
192 '''); 192 ''');
193 _createRefactoring('test ='); 193 _createRefactoring('test =');
194 expect(refactoring.refactoringName, 'Inline Local Variable'); 194 expect(refactoring.refactoringName, 'Inline Local Variable');
195 // check initial conditions and access 195 // check initial conditions and access
196 return refactoring.checkInitialConditions().then((_) { 196 return refactoring.checkInitialConditions().then((_) {
197 expect(refactoring.variableName, 'test');
197 expect(refactoring.referenceCount, 2); 198 expect(refactoring.referenceCount, 2);
198 }); 199 });
199 } 200 }
200 201
201 test_bad_selectionMethod() { 202 test_bad_selectionMethod() {
202 indexTestUnit(r''' 203 indexTestUnit(r'''
203 main() { 204 main() {
204 } 205 }
205 '''); 206 ''');
206 _createRefactoring('main() {'); 207 _createRefactoring('main() {');
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 int test; 272 int test;
272 } 273 }
273 '''); 274 ''');
274 _createRefactoring('test;'); 275 _createRefactoring('test;');
275 return refactoring.checkInitialConditions().then((status) { 276 return refactoring.checkInitialConditions().then((status) {
276 assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL); 277 assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL);
277 }); 278 });
278 } 279 }
279 280
280 void _assert_fatalError_selection(RefactoringStatus status) { 281 void _assert_fatalError_selection(RefactoringStatus status) {
282 expect(refactoring.variableName, isNull);
283 expect(refactoring.referenceCount, 0);
281 assertRefactoringStatus( 284 assertRefactoringStatus(
282 status, 285 status,
283 RefactoringProblemSeverity.FATAL, 286 RefactoringProblemSeverity.FATAL,
284 expectedMessage: 'Local variable declaration or reference must be ' 287 expectedMessage: 'Local variable declaration or reference must be '
285 'selected to activate this refactoring.'); 288 'selected to activate this refactoring.');
286 } 289 }
287 290
288 void _createRefactoring(String search) { 291 void _createRefactoring(String search) {
289 int offset = findOffset(search); 292 int offset = findOffset(search);
290 refactoring = new InlineLocalRefactoring(searchEngine, testUnit, offset); 293 refactoring = new InlineLocalRefactoring(searchEngine, testUnit, offset);
291 } 294 }
292 } 295 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/edit/refactoring_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698