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.context.directory.manager; | 5 library test.context.directory.manager; |
6 | 6 |
7 import 'package:analysis_server/src/context_manager.dart'; | 7 import 'package:analysis_server/src/context_manager.dart'; |
8 import 'reflective_tests.dart'; | 8 import 'reflective_tests.dart'; |
9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // set roots | 316 // set roots |
317 manager.setRoots(<String>[project], <String>[file2], <String, String>{}); | 317 manager.setRoots(<String>[project], <String>[file2], <String, String>{}); |
318 manager.assertContextPaths([project]); | 318 manager.assertContextPaths([project]); |
319 manager.assertContextFiles(project, [file1]); | 319 manager.assertContextFiles(project, [file1]); |
320 // stop excluding "2" | 320 // stop excluding "2" |
321 manager.setRoots(<String>[project], <String>[], <String, String>{}); | 321 manager.setRoots(<String>[project], <String>[], <String, String>{}); |
322 manager.assertContextPaths([project]); | 322 manager.assertContextPaths([project]); |
323 manager.assertContextFiles(project, [file1, file2]); | 323 manager.assertContextFiles(project, [file1, file2]); |
324 } | 324 } |
325 | 325 |
| 326 void test_setRoots_exclude_sameRoot_removeExcludedFile_inFolder() { |
| 327 // prepare paths |
| 328 String project = '/project'; |
| 329 String file1 = '$project/bin/file1.dart'; |
| 330 String file2 = '$project/bin/file2.dart'; |
| 331 // create files |
| 332 resourceProvider.newFile(file1, '// 1'); |
| 333 resourceProvider.newFile(file2, '// 2'); |
| 334 // set roots |
| 335 manager.setRoots(<String>[project], <String>[file2], <String, String>{}); |
| 336 manager.assertContextPaths([project]); |
| 337 manager.assertContextFiles(project, [file1]); |
| 338 // stop excluding "2" |
| 339 manager.setRoots(<String>[project], <String>[], <String, String>{}); |
| 340 manager.assertContextPaths([project]); |
| 341 manager.assertContextFiles(project, [file1, file2]); |
| 342 } |
| 343 |
326 void test_setRoots_exclude_sameRoot_removeExcludedFolder() { | 344 void test_setRoots_exclude_sameRoot_removeExcludedFolder() { |
327 // prepare paths | 345 // prepare paths |
328 String project = '/project'; | 346 String project = '/project'; |
329 String folderA = '$project/aaa'; | 347 String folderA = '$project/aaa'; |
330 String folderB = '$project/bbb'; | 348 String folderB = '$project/bbb'; |
331 String fileA = '$folderA/a.dart'; | 349 String fileA = '$folderA/a.dart'; |
332 String fileB = '$folderB/b.dart'; | 350 String fileB = '$folderB/b.dart'; |
333 // create files | 351 // create files |
334 resourceProvider.newFile(fileA, 'library a;'); | 352 resourceProvider.newFile(fileA, 'library a;'); |
335 resourceProvider.newFile(fileB, 'library b;'); | 353 resourceProvider.newFile(fileB, 'library b;'); |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 currentContextFilePaths.remove(path); | 836 currentContextFilePaths.remove(path); |
819 currentContextPackageUriResolvers.remove(path); | 837 currentContextPackageUriResolvers.remove(path); |
820 } | 838 } |
821 | 839 |
822 @override | 840 @override |
823 void updateContextPackageUriResolver(Folder contextFolder, | 841 void updateContextPackageUriResolver(Folder contextFolder, |
824 UriResolver packageUriResolver) { | 842 UriResolver packageUriResolver) { |
825 currentContextPackageUriResolvers[contextFolder.path] = packageUriResolver; | 843 currentContextPackageUriResolvers[contextFolder.path] = packageUriResolver; |
826 } | 844 } |
827 } | 845 } |
OLD | NEW |