| OLD | NEW |
| 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 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2389 '''); | 2389 '''); |
| 2390 assertHasFix(FixKind.MAKE_CLASS_ABSTRACT, ''' | 2390 assertHasFix(FixKind.MAKE_CLASS_ABSTRACT, ''' |
| 2391 abstract class A { | 2391 abstract class A { |
| 2392 m(); | 2392 m(); |
| 2393 } | 2393 } |
| 2394 abstract class B extends A { | 2394 abstract class B extends A { |
| 2395 } | 2395 } |
| 2396 '''); | 2396 '''); |
| 2397 } | 2397 } |
| 2398 | 2398 |
| 2399 void test_noException_1() { |
| 2400 resolveTestUnit(''' |
| 2401 main(p) { |
| 2402 p i s Null; |
| 2403 }'''); |
| 2404 List<AnalysisError> errors = context.computeErrors(testSource); |
| 2405 for (var error in errors) { |
| 2406 computeFixes(testUnit, error); |
| 2407 } |
| 2408 } |
| 2409 |
| 2399 void test_removeParentheses_inGetterDeclaration() { | 2410 void test_removeParentheses_inGetterDeclaration() { |
| 2400 resolveTestUnit(''' | 2411 resolveTestUnit(''' |
| 2401 class A { | 2412 class A { |
| 2402 int get foo() => 0; | 2413 int get foo() => 0; |
| 2403 } | 2414 } |
| 2404 '''); | 2415 '''); |
| 2405 assertHasFix(FixKind.REMOVE_PARAMETERS_IN_GETTER_DECLARATION, ''' | 2416 assertHasFix(FixKind.REMOVE_PARAMETERS_IN_GETTER_DECLARATION, ''' |
| 2406 class A { | 2417 class A { |
| 2407 int get foo => 0; | 2418 int get foo => 0; |
| 2408 } | 2419 } |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3495 | 3506 |
| 3496 List<Position> _findResultPositions(List<String> searchStrings) { | 3507 List<Position> _findResultPositions(List<String> searchStrings) { |
| 3497 List<Position> positions = <Position>[]; | 3508 List<Position> positions = <Position>[]; |
| 3498 for (String search in searchStrings) { | 3509 for (String search in searchStrings) { |
| 3499 int offset = resultCode.indexOf(search); | 3510 int offset = resultCode.indexOf(search); |
| 3500 positions.add(new Position(testFile, offset)); | 3511 positions.add(new Position(testFile, offset)); |
| 3501 } | 3512 } |
| 3502 return positions; | 3513 return positions; |
| 3503 } | 3514 } |
| 3504 } | 3515 } |
| OLD | NEW |