Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 1415713002: Ignore contexts in folders named 'packages' or starting with dot. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_inDotFolder() {
941 String pubspecPath = posix.join(projPath, '.pub', 'pubspec.yaml');
942 resourceProvider.newFile(pubspecPath, 'name: test');
943 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
944 // verify
945 expect(callbacks.currentContextPaths, hasLength(1));
946 expect(callbacks.currentContextPaths, contains(projPath));
947 expect(callbacks.currentContextFilePaths[projPath], hasLength(0));
948 }
949
950 void test_setRoots_noContext_inPackagesFolder() {
951 String pubspecPath = posix.join(projPath, 'packages', 'pubspec.yaml');
952 resourceProvider.newFile(pubspecPath, 'name: test');
953 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
954 // verify
955 expect(callbacks.currentContextPaths, hasLength(1));
956 expect(callbacks.currentContextPaths, contains(projPath));
957 expect(callbacks.currentContextFilePaths[projPath], hasLength(0));
958 }
959
940 void test_setRoots_packageResolver() { 960 void test_setRoots_packageResolver() {
941 Uri uri = Uri.parse('package:foo/foo.dart'); 961 Uri uri = Uri.parse('package:foo/foo.dart');
942 Source source = new TestSource(); 962 Source source = new TestSource();
943 packageResolver = new TestUriResolver({uri: source}); 963 packageResolver = new TestUriResolver({uri: source});
944 String filePath = posix.join(projPath, 'foo.dart'); 964 String filePath = posix.join(projPath, 'foo.dart');
945 resourceProvider.newFile(filePath, 'contents'); 965 resourceProvider.newFile(filePath, 'contents');
946 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 966 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
947 967
948 List<AnalysisContext> contextsInAnalysisRoot = 968 List<AnalysisContext> contextsInAnalysisRoot =
949 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); 969 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath));
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 class TestUriResolver extends UriResolver { 1834 class TestUriResolver extends UriResolver {
1815 Map<Uri, Source> uriMap; 1835 Map<Uri, Source> uriMap;
1816 1836
1817 TestUriResolver(this.uriMap); 1837 TestUriResolver(this.uriMap);
1818 1838
1819 @override 1839 @override
1820 Source resolveAbsolute(Uri uri, [Uri actualUri]) { 1840 Source resolveAbsolute(Uri uri, [Uri actualUri]) {
1821 return uriMap[uri]; 1841 return uriMap[uri];
1822 } 1842 }
1823 } 1843 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698