| 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 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1220 performAllAnalysisTasks(); | 1220 performAllAnalysisTasks(); |
| 1221 assertHasFix(FixKind.IMPORT_LIBRARY_PROJECT, ''' | 1221 assertHasFix(FixKind.IMPORT_LIBRARY_PROJECT, ''' |
| 1222 import 'lib.dart'; | 1222 import 'lib.dart'; |
| 1223 | 1223 |
| 1224 main() { | 1224 main() { |
| 1225 myFunction(); | 1225 myFunction(); |
| 1226 } | 1226 } |
| 1227 '''); | 1227 '''); |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 void test_importLibraryProject_withFunction_unresolvedMethod() { |
| 1231 addSource('/lib.dart', ''' |
| 1232 library lib; |
| 1233 myFunction() {} |
| 1234 '''); |
| 1235 _indexTestUnit(''' |
| 1236 class A { |
| 1237 main() { |
| 1238 myFunction(); |
| 1239 } |
| 1240 } |
| 1241 '''); |
| 1242 performAllAnalysisTasks(); |
| 1243 assertHasFix(FixKind.IMPORT_LIBRARY_PROJECT, ''' |
| 1244 import 'lib.dart'; |
| 1245 |
| 1246 class A { |
| 1247 main() { |
| 1248 myFunction(); |
| 1249 } |
| 1250 } |
| 1251 '''); |
| 1252 } |
| 1253 |
| 1230 void test_importLibraryProject_withTopLevelVariable() { | 1254 void test_importLibraryProject_withTopLevelVariable() { |
| 1231 addSource('/lib.dart', ''' | 1255 addSource('/lib.dart', ''' |
| 1232 library lib; | 1256 library lib; |
| 1233 int MY_VAR = 42; | 1257 int MY_VAR = 42; |
| 1234 '''); | 1258 '''); |
| 1235 _indexTestUnit(''' | 1259 _indexTestUnit(''' |
| 1236 main() { | 1260 main() { |
| 1237 print(MY_VAR); | 1261 print(MY_VAR); |
| 1238 } | 1262 } |
| 1239 '''); | 1263 '''); |
| (...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2219 positions.add(new Position(testFile, offset)); | 2243 positions.add(new Position(testFile, offset)); |
| 2220 } | 2244 } |
| 2221 return positions; | 2245 return positions; |
| 2222 } | 2246 } |
| 2223 | 2247 |
| 2224 void _indexTestUnit(String code) { | 2248 void _indexTestUnit(String code) { |
| 2225 resolveTestUnit(code); | 2249 resolveTestUnit(code); |
| 2226 index.indexUnit(context, testUnit); | 2250 index.indexUnit(context, testUnit); |
| 2227 } | 2251 } |
| 2228 } | 2252 } |
| OLD | NEW |