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

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

Issue 334573005: Unit test context removal (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 | « no previous file | pkg/analysis_server/test/mocks.dart » ('j') | 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 String projPath = '/my/proj'; 99 String projPath = '/my/proj';
100 provider.newFolder(projPath); 100 provider.newFolder(projPath);
101 String filePath = posix.join(projPath, 'foo', 'bar.dart'); 101 String filePath = posix.join(projPath, 'foo', 'bar.dart');
102 provider.newFile(filePath, 'contents'); 102 provider.newFile(filePath, 'contents');
103 manager.setRoots(<String>[projPath], <String>[]); 103 manager.setRoots(<String>[projPath], <String>[]);
104 var filePaths = manager.currentContextFilePaths[projPath]; 104 var filePaths = manager.currentContextFilePaths[projPath];
105 expect(filePaths, hasLength(1)); 105 expect(filePaths, hasLength(1));
106 expect(filePaths, contains(filePath)); 106 expect(filePaths, contains(filePath));
107 }); 107 });
108 108
109 test('remove folder with pubspec', () {
110 String projPath = '/my/proj';
111 String pubspecPath = posix.join(projPath, 'pubspec.yaml');
112 provider.newFolder(projPath);
113 provider.newFile(pubspecPath, 'pubspec');
114 manager.setRoots(<String>[projPath], <String>[]);
115 manager.setRoots(<String>[], <String>[]);
116 expect(manager.currentContextPaths, hasLength(0));
117 expect(manager.currentContextPubspecPaths, hasLength(0));
118 expect(manager.currentContextFilePaths, hasLength(0));
119 });
120
121 test('remove folder without pubspec', () {
122 String projPath = '/my/proj';
123 provider.newFolder(projPath);
124 manager.setRoots(<String>[projPath], <String>[]);
125 manager.setRoots(<String>[], <String>[]);
126 expect(manager.currentContextPaths, hasLength(0));
127 expect(manager.currentContextPubspecPaths, hasLength(0));
128 expect(manager.currentContextFilePaths, hasLength(0));
129 });
130
109 test('ignore files in packages dir', () { 131 test('ignore files in packages dir', () {
110 String projPath = '/my/proj'; 132 String projPath = '/my/proj';
111 provider.newFolder(projPath); 133 provider.newFolder(projPath);
112 String pubspecPath = posix.join(projPath, 'pubspec.yaml'); 134 String pubspecPath = posix.join(projPath, 'pubspec.yaml');
113 provider.newFile(pubspecPath, 'pubspec'); 135 provider.newFile(pubspecPath, 'pubspec');
114 String filePath1 = posix.join(projPath, 'packages', 'file1.dart'); 136 String filePath1 = posix.join(projPath, 'packages', 'file1.dart');
115 provider.newFile(filePath1, 'contents'); 137 provider.newFile(filePath1, 'contents');
116 manager.setRoots(<String>[projPath], <String>[]); 138 manager.setRoots(<String>[projPath], <String>[]);
117 Set<String> filePaths = manager.currentContextFilePaths[projPath]; 139 Set<String> filePaths = manager.currentContextFilePaths[projPath];
118 expect(filePaths, hasLength(0)); 140 expect(filePaths, hasLength(0));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 manager.setRoots(<String>[projPath], <String>[]); 183 manager.setRoots(<String>[projPath], <String>[]);
162 Set<String> filePaths = manager.currentContextFilePaths[projPath]; 184 Set<String> filePaths = manager.currentContextFilePaths[projPath];
163 expect(filePaths, hasLength(1)); 185 expect(filePaths, hasLength(1));
164 expect(filePaths, contains(filePath)); 186 expect(filePaths, contains(filePath));
165 provider.deleteFile(filePath); 187 provider.deleteFile(filePath);
166 return pumpEventQueue().then((_) => expect(filePaths, hasLength(0))); 188 return pumpEventQueue().then((_) => expect(filePaths, hasLength(0)));
167 }); 189 });
168 }); 190 });
169 }); 191 });
170 } 192 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analysis_server/test/mocks.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698