| 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:analysis_server/src/services/index/index.dart'; | 9 import 'package:analysis_server/src/services/index/index.dart'; |
| 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; | 10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; |
| (...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 } | 762 } |
| 763 '''); | 763 '''); |
| 764 assertHasFix(FixKind.CREATE_LOCAL_VARIABLE, ''' | 764 assertHasFix(FixKind.CREATE_LOCAL_VARIABLE, ''' |
| 765 main() { | 765 main() { |
| 766 int test; | 766 int test; |
| 767 test += 42; | 767 test += 42; |
| 768 } | 768 } |
| 769 '''); | 769 '''); |
| 770 } | 770 } |
| 771 | 771 |
| 772 void test_createMissingOverrides_functionType() { | 772 void test_createMissingOverrides_functionTypeAlias() { |
| 773 _indexTestUnit(''' |
| 774 typedef int Binary(int left, int right); |
| 775 |
| 776 abstract class Emulator { |
| 777 void performBinary(Binary binary); |
| 778 } |
| 779 |
| 780 class MyEmulator extends Emulator { |
| 781 } |
| 782 '''); |
| 783 assertHasFix(FixKind.CREATE_MISSING_OVERRIDES, ''' |
| 784 typedef int Binary(int left, int right); |
| 785 |
| 786 abstract class Emulator { |
| 787 void performBinary(Binary binary); |
| 788 } |
| 789 |
| 790 class MyEmulator extends Emulator { |
| 791 @override |
| 792 void performBinary(Binary binary) { |
| 793 // TODO: implement performBinary |
| 794 } |
| 795 } |
| 796 '''); |
| 797 } |
| 798 |
| 799 void test_createMissingOverrides_functionTypedParameter() { |
| 773 _indexTestUnit(''' | 800 _indexTestUnit(''' |
| 774 abstract class A { | 801 abstract class A { |
| 775 forEach(int f(double p1, String p2)); | 802 forEach(int f(double p1, String p2)); |
| 776 } | 803 } |
| 777 | 804 |
| 778 class B extends A { | 805 class B extends A { |
| 779 } | 806 } |
| 780 '''); | 807 '''); |
| 781 assertHasFix(FixKind.CREATE_MISSING_OVERRIDES, ''' | 808 assertHasFix(FixKind.CREATE_MISSING_OVERRIDES, ''' |
| 782 abstract class A { | 809 abstract class A { |
| (...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2517 positions.add(new Position(testFile, offset)); | 2544 positions.add(new Position(testFile, offset)); |
| 2518 } | 2545 } |
| 2519 return positions; | 2546 return positions; |
| 2520 } | 2547 } |
| 2521 | 2548 |
| 2522 void _indexTestUnit(String code) { | 2549 void _indexTestUnit(String code) { |
| 2523 resolveTestUnit(code); | 2550 resolveTestUnit(code); |
| 2524 index.indexUnit(context, testUnit); | 2551 index.indexUnit(context, testUnit); |
| 2525 } | 2552 } |
| 2526 } | 2553 } |
| OLD | NEW |