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

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

Issue 303413003: Don't add files inside "packages" subdir to context. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/lib/src/resource.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 'mocks.dart'; 7 import 'mocks.dart';
8 import 'package:analysis_server/src/context_directory_manager.dart'; 8 import 'package:analysis_server/src/context_directory_manager.dart';
9 import 'package:analysis_server/src/resource.dart'; 9 import 'package:analysis_server/src/resource.dart';
10 import 'package:path/path.dart'; 10 import 'package:path/path.dart';
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 String projPath = '/my/proj'; 90 String projPath = '/my/proj';
91 provider.newFolder(projPath); 91 provider.newFolder(projPath);
92 String filePath = posix.join(projPath, 'foo', 'bar.dart'); 92 String filePath = posix.join(projPath, 'foo', 'bar.dart');
93 provider.newFile(filePath, 'contents'); 93 provider.newFile(filePath, 'contents');
94 manager.setRoots(<String>[projPath], <String>[]); 94 manager.setRoots(<String>[projPath], <String>[]);
95 var filePaths = manager.currentContextFilePaths[projPath]; 95 var filePaths = manager.currentContextFilePaths[projPath];
96 expect(filePaths, hasLength(1)); 96 expect(filePaths, hasLength(1));
97 expect(filePaths, contains(filePath)); 97 expect(filePaths, contains(filePath));
98 }); 98 });
99 99
100 test('ignore files in packages dir', () {
101 String projPath = '/my/proj';
102 provider.newFolder(projPath);
103 String pubspecPath = posix.join(projPath, 'pubspec.yaml');
104 provider.newFile(pubspecPath, 'pubspec');
105 String filePath1 = posix.join(projPath, 'packages', 'file1.dart');
106 provider.newFile(filePath1, 'contents');
107 manager.setRoots(<String>[projPath], <String>[]);
108 Set<String> filePaths = manager.currentContextFilePaths[projPath];
109 expect(filePaths, hasLength(0));
110 String filePath2 = posix.join(projPath, 'packages', 'file2.dart');
111 provider.newFile(filePath2, 'contents');
112 return pumpEventQueue().then((_) {
113 expect(filePaths, hasLength(0));
114 });
115 });
116
100 group('detect context modifications', () { 117 group('detect context modifications', () {
101 String projPath; 118 String projPath;
102 119
103 setUp(() { 120 setUp(() {
104 projPath = '/my/proj'; 121 projPath = '/my/proj';
105 provider.newFolder(projPath); 122 provider.newFolder(projPath);
106 }); 123 });
107 124
108 test('Add file', () { 125 test('Add file', () {
109 manager.setRoots(<String>[projPath], <String>[]); 126 manager.setRoots(<String>[projPath], <String>[]);
(...skipping 25 matching lines...) Expand all
135 manager.setRoots(<String>[projPath], <String>[]); 152 manager.setRoots(<String>[projPath], <String>[]);
136 Set<String> filePaths = manager.currentContextFilePaths[projPath]; 153 Set<String> filePaths = manager.currentContextFilePaths[projPath];
137 expect(filePaths, hasLength(1)); 154 expect(filePaths, hasLength(1));
138 expect(filePaths, contains(filePath)); 155 expect(filePaths, contains(filePath));
139 provider.deleteFile(filePath); 156 provider.deleteFile(filePath);
140 return pumpEventQueue().then((_) => expect(filePaths, hasLength(0))); 157 return pumpEventQueue().then((_) => expect(filePaths, hasLength(0)));
141 }); 158 });
142 }); 159 });
143 }); 160 });
144 } 161 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/resource.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698