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

Side by Side Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1053723002: Fix a null-pointer reference and minor clean-up (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added tests Created 5 years, 8 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/lib/src/services/correction/fix_internal.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.correction.fix; 5 library test.services.correction.fix;
6 6
7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
8 import 'package:analysis_server/src/services/correction/fix.dart'; 8 import 'package:analysis_server/src/services/correction/fix.dart';
9 import 'package:analyzer/file_system/file_system.dart'; 9 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:analyzer/source/package_map_resolver.dart'; 10 import 'package:analyzer/source/package_map_resolver.dart';
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 414
415 method() {} 415 method() {}
416 } 416 }
417 main() { 417 main() {
418 new A.named(1, 2.0); 418 new A.named(1, 2.0);
419 } 419 }
420 '''); 420 ''');
421 _assertLinkedGroup(change.linkedEditGroups[0], ['named(int ', 'named(1']); 421 _assertLinkedGroup(change.linkedEditGroups[0], ['named(int ', 'named(1']);
422 } 422 }
423 423
424 void test_createConstructorForFinalFields_inTopLevelMethod() {
425 resolveTestUnit('''
426 main() {
427 final int v;
428 }
429 ''');
430 assertNoFix(FixKind.CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS);
431 }
432
433 void test_createConstructorForFinalFields_topLevelField() {
434 resolveTestUnit('''
435 final int v;
436 ''');
437 assertNoFix(FixKind.CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS);
438 }
439
424 void test_createConstructorSuperExplicit() { 440 void test_createConstructorSuperExplicit() {
425 resolveTestUnit(''' 441 resolveTestUnit('''
426 class A { 442 class A {
427 A(bool p1, int p2, double p3, String p4, {p5}); 443 A(bool p1, int p2, double p3, String p4, {p5});
428 } 444 }
429 class B extends A { 445 class B extends A {
430 B() {} 446 B() {}
431 } 447 }
432 '''); 448 ''');
433 assertHasFix(FixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, ''' 449 assertHasFix(FixKind.ADD_SUPER_CONSTRUCTOR_INVOCATION, '''
(...skipping 3072 matching lines...) Expand 10 before | Expand all | Expand 10 after
3506 3522
3507 List<Position> _findResultPositions(List<String> searchStrings) { 3523 List<Position> _findResultPositions(List<String> searchStrings) {
3508 List<Position> positions = <Position>[]; 3524 List<Position> positions = <Position>[];
3509 for (String search in searchStrings) { 3525 for (String search in searchStrings) {
3510 int offset = resultCode.indexOf(search); 3526 int offset = resultCode.indexOf(search);
3511 positions.add(new Position(testFile, offset)); 3527 positions.add(new Position(testFile, offset));
3512 } 3528 }
3513 return positions; 3529 return positions;
3514 } 3530 }
3515 } 3531 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698