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

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

Issue 1916063003: We don't use path filter in SingleContextManager. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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/single_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.analysis_server.src.single_context_manager; 5 library test.analysis_server.src.single_context_manager;
6 6
7 import 'dart:core' hide Resource; 7 import 'dart:core' hide Resource;
8 8
9 import 'package:analysis_server/src/single_context_manager.dart'; 9 import 'package:analysis_server/src/single_context_manager.dart';
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 DartSdkManager sdkManager = new DartSdkManager((_) { 76 DartSdkManager sdkManager = new DartSdkManager((_) {
77 return new MockSdk(); 77 return new MockSdk();
78 }); 78 });
79 manager = new SingleContextManager(resourceProvider, sdkManager, 79 manager = new SingleContextManager(resourceProvider, sdkManager,
80 () => packageResolver, analysisFilesGlobs); 80 () => packageResolver, analysisFilesGlobs);
81 callbacks = new TestContextManagerCallbacks(resourceProvider); 81 callbacks = new TestContextManagerCallbacks(resourceProvider);
82 manager.callbacks = callbacks; 82 manager.callbacks = callbacks;
83 resourceProvider.newFolder(projPath); 83 resourceProvider.newFolder(projPath);
84 } 84 }
85 85
86 void test_isIgnored_false() {
87 String project = '/project';
88 manager.setRoots(<String>[project], <String>[], <String, String>{});
89 expect(manager.isIgnored('$project/file.dart'), isFalse);
90 }
91
92 void test_isIgnored_true_inDotFolder() {
93 String project = '/project';
94 manager.setRoots(<String>[project], <String>[], <String, String>{});
95 expect(manager.isIgnored('$project/foo/.bar/file.dart'), isTrue);
96 }
97
98 void test_isIgnored_true_inExcludedPath() {
99 String project = '/project';
100 String excludedPath = '/project/excluded';
101 manager.setRoots(
102 <String>[project], <String>[excludedPath], <String, String>{});
103 expect(manager.isIgnored('$excludedPath/file.dart'), isTrue);
104 }
105
106 void test_isIgnored_true_notInRoot() {
107 String root1 = '/context/root1';
108 String root2 = '/context/root2';
109 manager.setRoots(<String>[root1, root2], <String>[], <String, String>{});
110 expect(manager.isIgnored('$context/root3/file.dart'), isTrue);
111 }
112
113 void test_isInAnalysisRoot_false_inExcludedPath() {
114 String project = '/project';
115 String excludedPath = '/project/excluded';
116 manager.setRoots(
117 <String>[project], <String>[excludedPath], <String, String>{});
118 expect(manager.isInAnalysisRoot('$excludedPath/file.dart'), isFalse);
119 }
120
121 void test_isInAnalysisRoot_false_notInRoot() {
122 String root1 = '/context/root1';
123 String root2 = '/context/root2';
124 manager.setRoots(<String>[root1, root2], <String>[], <String, String>{});
125 expect(manager.isInAnalysisRoot('$context/root3/file.dart'), isFalse);
126 }
127
128 void test_isInAnalysisRoot_true() {
129 String project = '/project';
130 manager.setRoots(<String>[project], <String>[], <String, String>{});
131 expect(manager.isInAnalysisRoot('$project/file.dart'), isTrue);
132 }
133
86 void test_setRoots_addFolderWithDartFile() { 134 void test_setRoots_addFolderWithDartFile() {
87 String filePath = posix.join(projPath, 'lib', 'foo.dart'); 135 String filePath = posix.join(projPath, 'lib', 'foo.dart');
88 resourceProvider.newFile(filePath, 'contents'); 136 resourceProvider.newFile(filePath, 'contents');
89 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); 137 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
90 // verify 138 // verify
91 callbacks.assertContextFiles(projPath, [filePath]); 139 callbacks.assertContextFiles(projPath, [filePath]);
92 // There is an analysis context. 140 // There is an analysis context.
93 List<AnalysisContext> contextsInAnalysisRoot = 141 List<AnalysisContext> contextsInAnalysisRoot =
94 manager.contextsInAnalysisRoot(rootFolder); 142 manager.contextsInAnalysisRoot(rootFolder);
95 expect(contextsInAnalysisRoot, hasLength(1)); 143 expect(contextsInAnalysisRoot, hasLength(1));
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 String relPath = resourceProvider.pathContext.joinAll(relSegments); 517 String relPath = resourceProvider.pathContext.joinAll(relSegments);
470 Resource file = rootFolder.getChild(relPath); 518 Resource file = rootFolder.getChild(relPath);
471 if (file is File && file.exists) { 519 if (file is File && file.exists) {
472 return file.createSource(uri); 520 return file.createSource(uri);
473 } 521 }
474 } 522 }
475 } 523 }
476 return null; 524 return null;
477 } 525 }
478 } 526 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/single_context_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698