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 'dart:collection'; | 7 import 'dart:collection'; |
8 | 8 |
9 import 'package:analysis_server/src/context_manager.dart'; | 9 import 'package:analysis_server/src/context_manager.dart'; |
10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 void test_setRoots_newlyAddedFoldersGetProperPackageMap() { | 930 void test_setRoots_newlyAddedFoldersGetProperPackageMap() { |
931 String packagePath = '/package/foo'; | 931 String packagePath = '/package/foo'; |
932 Folder packageFolder = resourceProvider.newFolder(packagePath); | 932 Folder packageFolder = resourceProvider.newFolder(packagePath); |
933 packageMapProvider.packageMap = { | 933 packageMapProvider.packageMap = { |
934 'foo': [packageFolder] | 934 'foo': [packageFolder] |
935 }; | 935 }; |
936 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); | 936 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
937 _checkPackageMap(projPath, equals(packageMapProvider.packageMap)); | 937 _checkPackageMap(projPath, equals(packageMapProvider.packageMap)); |
938 } | 938 } |
939 | 939 |
| 940 void test_setRoots_noContext_excludedFolder() { |
| 941 // prepare paths |
| 942 String project = '/project'; |
| 943 String excludedFolder = '$project/excluded'; |
| 944 String excludedPubspec = '$excludedFolder/pubspec.yaml'; |
| 945 // create files |
| 946 resourceProvider.newFile(excludedPubspec, 'name: ignore-me'); |
| 947 // set "/project", and exclude "/project/excluded" |
| 948 manager.setRoots( |
| 949 <String>[project], <String>[excludedFolder], <String, String>{}); |
| 950 callbacks.assertContextPaths([project]); |
| 951 } |
| 952 |
940 void test_setRoots_noContext_inDotFolder() { | 953 void test_setRoots_noContext_inDotFolder() { |
941 String pubspecPath = posix.join(projPath, '.pub', 'pubspec.yaml'); | 954 String pubspecPath = posix.join(projPath, '.pub', 'pubspec.yaml'); |
942 resourceProvider.newFile(pubspecPath, 'name: test'); | 955 resourceProvider.newFile(pubspecPath, 'name: test'); |
943 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); | 956 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
944 // verify | 957 // verify |
945 expect(callbacks.currentContextPaths, hasLength(1)); | 958 expect(callbacks.currentContextPaths, hasLength(1)); |
946 expect(callbacks.currentContextPaths, contains(projPath)); | 959 expect(callbacks.currentContextPaths, contains(projPath)); |
947 expect(callbacks.currentContextFilePaths[projPath], hasLength(0)); | 960 expect(callbacks.currentContextFilePaths[projPath], hasLength(0)); |
948 } | 961 } |
949 | 962 |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 class TestUriResolver extends UriResolver { | 1847 class TestUriResolver extends UriResolver { |
1835 Map<Uri, Source> uriMap; | 1848 Map<Uri, Source> uriMap; |
1836 | 1849 |
1837 TestUriResolver(this.uriMap); | 1850 TestUriResolver(this.uriMap); |
1838 | 1851 |
1839 @override | 1852 @override |
1840 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 1853 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
1841 return uriMap[uri]; | 1854 return uriMap[uri]; |
1842 } | 1855 } |
1843 } | 1856 } |
OLD | NEW |