| 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 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 performAllAnalysisTasks(); | 953 performAllAnalysisTasks(); |
| 954 assertHasFix(FixKind.IMPORT_LIBRARY_PROJECT, ''' | 954 assertHasFix(FixKind.IMPORT_LIBRARY_PROJECT, ''' |
| 955 import 'lib.dart'; | 955 import 'lib.dart'; |
| 956 | 956 |
| 957 main() { | 957 main() { |
| 958 print(MY_VAR); | 958 print(MY_VAR); |
| 959 } | 959 } |
| 960 '''); | 960 '''); |
| 961 } | 961 } |
| 962 | 962 |
| 963 void test_importLibraryProject_withType_annotation() { |
| 964 addSource('/lib.dart', ''' |
| 965 library lib; |
| 966 class Test { |
| 967 const Test(int p); |
| 968 } |
| 969 '''); |
| 970 _indexTestUnit(''' |
| 971 @Test(0) |
| 972 main() { |
| 973 } |
| 974 '''); |
| 975 performAllAnalysisTasks(); |
| 976 assertHasFix(FixKind.IMPORT_LIBRARY_PROJECT, ''' |
| 977 import 'lib.dart'; |
| 978 |
| 979 @Test(0) |
| 980 main() { |
| 981 } |
| 982 '''); |
| 983 } |
| 984 |
| 963 void test_importLibraryProject_withType_inParentFolder() { | 985 void test_importLibraryProject_withType_inParentFolder() { |
| 964 testFile = '/project/bin/test.dart'; | 986 testFile = '/project/bin/test.dart'; |
| 965 addSource('/project/lib.dart', ''' | 987 addSource('/project/lib.dart', ''' |
| 966 library lib; | 988 library lib; |
| 967 class Test {} | 989 class Test {} |
| 968 '''); | 990 '''); |
| 969 _indexTestUnit(''' | 991 _indexTestUnit(''' |
| 970 main() { | 992 main() { |
| 971 Test t = null; | 993 Test t = null; |
| 972 } | 994 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 performAllAnalysisTasks(); | 1054 performAllAnalysisTasks(); |
| 1033 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' | 1055 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' |
| 1034 import 'dart:math'; | 1056 import 'dart:math'; |
| 1035 | 1057 |
| 1036 main() { | 1058 main() { |
| 1037 print(PI); | 1059 print(PI); |
| 1038 } | 1060 } |
| 1039 '''); | 1061 '''); |
| 1040 } | 1062 } |
| 1041 | 1063 |
| 1064 void test_importLibrarySdk_withTopLevelVariable_annotation() { |
| 1065 _indexTestUnit(''' |
| 1066 @PI |
| 1067 main() { |
| 1068 } |
| 1069 '''); |
| 1070 performAllAnalysisTasks(); |
| 1071 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' |
| 1072 import 'dart:math'; |
| 1073 |
| 1074 @PI |
| 1075 main() { |
| 1076 } |
| 1077 '''); |
| 1078 } |
| 1079 |
| 1042 void test_importLibrarySdk_withType_invocationTarget() { | 1080 void test_importLibrarySdk_withType_invocationTarget() { |
| 1043 _indexTestUnit(''' | 1081 _indexTestUnit(''' |
| 1044 main() { | 1082 main() { |
| 1045 Future.wait(null); | 1083 Future.wait(null); |
| 1046 } | 1084 } |
| 1047 '''); | 1085 '''); |
| 1048 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' | 1086 assertHasFix(FixKind.IMPORT_LIBRARY_SDK, ''' |
| 1049 import 'dart:async'; | 1087 import 'dart:async'; |
| 1050 | 1088 |
| 1051 main() { | 1089 main() { |
| (...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 positions.add(new Position(testFile, offset)); | 1865 positions.add(new Position(testFile, offset)); |
| 1828 } | 1866 } |
| 1829 return positions; | 1867 return positions; |
| 1830 } | 1868 } |
| 1831 | 1869 |
| 1832 void _indexTestUnit(String code) { | 1870 void _indexTestUnit(String code) { |
| 1833 resolveTestUnit(code); | 1871 resolveTestUnit(code); |
| 1834 index.indexUnit(context, testUnit); | 1872 index.indexUnit(context, testUnit); |
| 1835 } | 1873 } |
| 1836 } | 1874 } |
| OLD | NEW |