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

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

Issue 1922643002: Only add files that are match an analyzed files glob. (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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // exclude "bbb/" 240 // exclude "bbb/"
241 manager.setRoots(<String>[project], <String>[folderB], <String, String>{}); 241 manager.setRoots(<String>[project], <String>[folderB], <String, String>{});
242 callbacks.assertContextPaths([project]); 242 callbacks.assertContextPaths([project]);
243 callbacks.assertContextFiles(project, [fileA]); 243 callbacks.assertContextFiles(project, [fileA]);
244 // stop excluding "bbb/" 244 // stop excluding "bbb/"
245 manager.setRoots(<String>[project], <String>[], <String, String>{}); 245 manager.setRoots(<String>[project], <String>[], <String, String>{});
246 callbacks.assertContextPaths([project]); 246 callbacks.assertContextPaths([project]);
247 callbacks.assertContextFiles(project, [fileA, fileB]); 247 callbacks.assertContextFiles(project, [fileA, fileB]);
248 } 248 }
249 249
250 void test_setRoots_ignoreGlobs() {
251 String file1 = '$projPath/file.dart';
252 String file2 = '$projPath/file.foo';
253 // create files
254 resourceProvider.newFile(file1, '');
255 resourceProvider.newFile(file2, '');
256 // set roots
257 manager.setRoots(<String>[projPath], <String>[], <String, String>{});
258 callbacks.assertContextPaths([projPath]);
259 callbacks.assertContextFiles(projPath, [file1]);
260 }
261
250 void test_setRoots_pathContainsDotFile() { 262 void test_setRoots_pathContainsDotFile() {
251 // If the path to a file (relative to the context root) contains a folder 263 // If the path to a file (relative to the context root) contains a folder
252 // whose name begins with '.', then the file is ignored. 264 // whose name begins with '.', then the file is ignored.
253 String project = '/project'; 265 String project = '/project';
254 String fileA = '$project/foo.dart'; 266 String fileA = '$project/foo.dart';
255 String fileB = '$project/.pub/bar.dart'; 267 String fileB = '$project/.pub/bar.dart';
256 resourceProvider.newFile(fileA, ''); 268 resourceProvider.newFile(fileA, '');
257 resourceProvider.newFile(fileB, ''); 269 resourceProvider.newFile(fileB, '');
258 manager.setRoots(<String>[project], <String>[], <String, String>{}); 270 manager.setRoots(<String>[project], <String>[], <String, String>{});
259 callbacks.assertContextPaths([project]); 271 callbacks.assertContextPaths([project]);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 String relPath = resourceProvider.pathContext.joinAll(relSegments); 312 String relPath = resourceProvider.pathContext.joinAll(relSegments);
301 Resource file = rootFolder.getChild(relPath); 313 Resource file = rootFolder.getChild(relPath);
302 if (file is File && file.exists) { 314 if (file is File && file.exists) {
303 return file.createSource(uri); 315 return file.createSource(uri);
304 } 316 }
305 } 317 }
306 } 318 }
307 return null; 319 return null;
308 } 320 }
309 } 321 }
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