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

Side by Side Diff: pkg/analyzer/test/file_system/physical_resource_provider_test.dart

Issue 456893002: Support for excluded files/folders. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
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.physical_file_system; 5 library test.physical_file_system;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import 'package:analyzer/file_system/file_system.dart'; 10 import 'package:analyzer/file_system/file_system.dart';
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 File file2 = PhysicalResourceProvider.INSTANCE.getResource(path); 166 File file2 = PhysicalResourceProvider.INSTANCE.getResource(path);
167 expect(file == file2, isTrue); 167 expect(file == file2, isTrue);
168 }); 168 });
169 169
170 test('equality: different paths', () { 170 test('equality: different paths', () {
171 String path2 = join(tempPath, 'file2.txt'); 171 String path2 = join(tempPath, 'file2.txt');
172 File file2 = PhysicalResourceProvider.INSTANCE.getResource(path2); 172 File file2 = PhysicalResourceProvider.INSTANCE.getResource(path2);
173 expect(file == file2, isFalse); 173 expect(file == file2, isFalse);
174 }); 174 });
175 175
176 test('isOrContains', () {
177 File file = PhysicalResourceProvider.INSTANCE.getResource(path);
178 expect(file.isOrContains(path), isTrue);
179 expect(file.isOrContains('foo'), isFalse);
180 });
181
176 test('shortName', () { 182 test('shortName', () {
177 expect(file.shortName, 'file.txt'); 183 expect(file.shortName, 'file.txt');
178 }); 184 });
179 185
180 test('toString', () { 186 test('toString', () {
181 expect(file.toString(), path); 187 expect(file.toString(), path);
182 }); 188 });
183 189
184 test('parent', () { 190 test('parent', () {
185 Resource parent = file.parent; 191 Resource parent = file.parent;
(...skipping 29 matching lines...) Expand all
215 expect(folder == folder2, isFalse); 221 expect(folder == folder2, isFalse);
216 }); 222 });
217 223
218 test('contains', () { 224 test('contains', () {
219 expect(folder.contains(join(path, 'aaa.txt')), isTrue); 225 expect(folder.contains(join(path, 'aaa.txt')), isTrue);
220 expect(folder.contains(join(path, 'aaa', 'bbb.txt')), isTrue); 226 expect(folder.contains(join(path, 'aaa', 'bbb.txt')), isTrue);
221 expect(folder.contains(join(tempPath, 'baz.txt')), isFalse); 227 expect(folder.contains(join(tempPath, 'baz.txt')), isFalse);
222 expect(folder.contains(path), isFalse); 228 expect(folder.contains(path), isFalse);
223 }); 229 });
224 230
231 test('isOrContains', () {
232 expect(folder.isOrContains(path), isTrue);
233 expect(folder.isOrContains(join(path, 'aaa.txt')), isTrue);
234 expect(folder.isOrContains(join(path, 'aaa', 'bbb.txt')), isTrue);
235 expect(folder.isOrContains(join(tempPath, 'baz.txt')), isFalse);
236 });
237
225 group('getChild', () { 238 group('getChild', () {
226 test('does not exist', () { 239 test('does not exist', () {
227 var child = folder.getChild('no-such-resource'); 240 var child = folder.getChild('no-such-resource');
228 expect(child, isNotNull); 241 expect(child, isNotNull);
229 expect(child.exists, isFalse); 242 expect(child.exists, isFalse);
230 }); 243 });
231 244
232 test('file', () { 245 test('file', () {
233 new io.File(join(path, 'myFile')).createSync(); 246 new io.File(join(path, 'myFile')).createSync();
234 var child = folder.getChild('myFile'); 247 var child = folder.getChild('myFile');
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 expect(folder.canonicalizePath('baz'), equals(join(path, 'baz'))); 306 expect(folder.canonicalizePath('baz'), equals(join(path, 'baz')));
294 expect(folder.canonicalizePath(path2), equals(path2)); 307 expect(folder.canonicalizePath(path2), equals(path2));
295 expect(folder.canonicalizePath(join('..', 'folder2')), equals(path2)); 308 expect(folder.canonicalizePath(join('..', 'folder2')), equals(path2));
296 expect(folder.canonicalizePath(join(path2, '..', 'folder3')), equals(p ath3)); 309 expect(folder.canonicalizePath(join(path2, '..', 'folder3')), equals(p ath3));
297 expect(folder.canonicalizePath(join('.', 'baz')), equals(join(path, 'b az'))); 310 expect(folder.canonicalizePath(join('.', 'baz')), equals(join(path, 'b az')));
298 expect(folder.canonicalizePath(join(path2, '.', 'baz')), equals(join(p ath2, 'baz'))); 311 expect(folder.canonicalizePath(join(path2, '.', 'baz')), equals(join(p ath2, 'baz')));
299 }); 312 });
300 }); 313 });
301 }); 314 });
302 } 315 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698