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

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

Issue 871013012: Issue 22188. Verify that none or all execution flows return. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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.extract_method; 5 library test.services.refactoring.extract_method;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/correction/status.dart'; 10 import 'package:analysis_server/src/services/correction/status.dart';
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 // end 433 // end
434 print(v); 434 print(v);
435 } 435 }
436 '''); 436 ''');
437 _createRefactoringForStartEndComments(); 437 _createRefactoringForStartEndComments();
438 return _assertConditionsFatal( 438 return _assertConditionsFatal(
439 "Ambiguous return value: Selected block contains assignment(s) to " 439 "Ambiguous return value: Selected block contains assignment(s) to "
440 "local variables and return statement."); 440 "local variables and return statement.");
441 } 441 }
442 442
443 test_bad_statements_return_notAllExecutionFlows() {
444 indexTestUnit('''
445 main(int p) {
446 // start
447 if (p == 0) {
448 return;
449 }
450 // end
451 print(p);
452 }
453 ''');
454 _createRefactoringForStartEndComments();
455 return _assertConditionsError(
456 "Selected statements contain a return statement, but not all possible "
Paul Berry 2015/02/10 18:25:16 Nit: it would be nice to put this string in a cons
457 "execuion flows end in a return. Semantics may not be preserved.");
458 }
459
443 test_bad_switchCase() { 460 test_bad_switchCase() {
444 indexTestUnit(''' 461 indexTestUnit('''
445 main() { 462 main() {
446 switch (1) { 463 switch (1) {
447 // start 464 // start
448 case 0: break; 465 case 0: break;
449 // end 466 // end
450 } 467 }
451 } 468 }
452 '''); 469 ''');
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2451 * Returns a deep copy of [refactoring] parameters. 2468 * Returns a deep copy of [refactoring] parameters.
2452 * There was a bug masked by updating parameter instances shared between the 2469 * There was a bug masked by updating parameter instances shared between the
2453 * refactoring and the test. 2470 * refactoring and the test.
2454 */ 2471 */
2455 List<RefactoringMethodParameter> _getParametersCopy() { 2472 List<RefactoringMethodParameter> _getParametersCopy() {
2456 return refactoring.parameters.map((p) { 2473 return refactoring.parameters.map((p) {
2457 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id); 2474 return new RefactoringMethodParameter(p.kind, p.type, p.name, id: p.id);
2458 }).toList(); 2475 }).toList();
2459 } 2476 }
2460 } 2477 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698