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.refactoring.move_files; | 5 library test.services.refactoring.move_files; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; | 9 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; |
10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 import '22/new_name.dart'; | 104 import '22/new_name.dart'; |
105 '''); | 105 '''); |
106 assertNoFileChange(testFile); | 106 assertNoFileChange(testFile); |
107 } | 107 } |
108 | 108 |
109 test_file_importedLibrary_package() async { | 109 test_file_importedLibrary_package() async { |
110 // configure packages | 110 // configure packages |
111 testFile = '/packages/my_pkg/lib/aaa/test.dart'; | 111 testFile = '/packages/my_pkg/lib/aaa/test.dart'; |
112 provider.newFile(testFile, ''); | 112 provider.newFile(testFile, ''); |
113 Map<String, List<Folder>> packageMap = { | 113 Map<String, List<Folder>> packageMap = { |
114 'my_pkg': [provider.getResource('/packages/my_pkg/lib')] | 114 'my_pkg': <Folder>[provider.getResource('/packages/my_pkg/lib')] |
115 }; | 115 }; |
116 context.sourceFactory = new SourceFactory([ | 116 context.sourceFactory = new SourceFactory([ |
117 AbstractContextTest.SDK_RESOLVER, | 117 AbstractContextTest.SDK_RESOLVER, |
118 new PackageMapUriResolver(provider, packageMap), | 118 new PackageMapUriResolver(provider, packageMap), |
119 resourceResolver | 119 resourceResolver |
120 ]); | 120 ]); |
121 // do testing | 121 // do testing |
122 String pathA = '/project/bin/a.dart'; | 122 String pathA = '/project/bin/a.dart'; |
123 addSource( | 123 addSource( |
124 pathA, | 124 pathA, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 addSource( | 236 addSource( |
237 appPath, | 237 appPath, |
238 ''' | 238 ''' |
239 import 'package:testName/myLib.dart'; | 239 import 'package:testName/myLib.dart'; |
240 export 'package:testName/myLib.dart'; | 240 export 'package:testName/myLib.dart'; |
241 '''); | 241 '''); |
242 // configure Uri resolves | 242 // configure Uri resolves |
243 context.sourceFactory = new SourceFactory([ | 243 context.sourceFactory = new SourceFactory([ |
244 AbstractContextTest.SDK_RESOLVER, | 244 AbstractContextTest.SDK_RESOLVER, |
245 new PackageMapUriResolver(provider, <String, List<Folder>>{ | 245 new PackageMapUriResolver(provider, <String, List<Folder>>{ |
246 'testName': [provider.getResource('/testName/lib')] | 246 'testName': <Folder>[provider.getResource('/testName/lib')] |
247 }), | 247 }), |
248 resourceResolver, | 248 resourceResolver, |
249 ]); | 249 ]); |
250 // analyze | 250 // analyze |
251 _performAnalysis(); | 251 _performAnalysis(); |
252 // perform refactoring | 252 // perform refactoring |
253 refactoring = new MoveFileRefactoring( | 253 refactoring = new MoveFileRefactoring( |
254 provider, searchEngine, context, null, '/testName'); | 254 provider, searchEngine, context, null, '/testName'); |
255 refactoring.newFile = '/newName'; | 255 refactoring.newFile = '/newName'; |
256 await _assertSuccessfulRefactoring(); | 256 await _assertSuccessfulRefactoring(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 break; | 290 break; |
291 } | 291 } |
292 for (ChangeNotice notice in result.changeNotices) { | 292 for (ChangeNotice notice in result.changeNotices) { |
293 if (notice.source.fullName.startsWith('/project/')) { | 293 if (notice.source.fullName.startsWith('/project/')) { |
294 index.indexUnit(notice.resolvedDartUnit); | 294 index.indexUnit(notice.resolvedDartUnit); |
295 } | 295 } |
296 } | 296 } |
297 } | 297 } |
298 } | 298 } |
299 } | 299 } |
OLD | NEW |