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

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

Issue 952333002: Don't do folder existence checks when parsing pub list results. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 }); 286 });
287 287
288 test('folder', () { 288 test('folder', () {
289 new io.Directory(join(path, 'myFolder')).createSync(); 289 new io.Directory(join(path, 'myFolder')).createSync();
290 var child = folder.getChild('myFolder'); 290 var child = folder.getChild('myFolder');
291 expect(child, _isFolder); 291 expect(child, _isFolder);
292 expect(child.exists, isTrue); 292 expect(child.exists, isTrue);
293 }); 293 });
294 }); 294 });
295 295
296 group('getChildAssumingFolder', () {
297 test('does not exist', () {
298 Folder child = folder.getChildAssumingFolder('no-such-resource');
299 expect(child, isNotNull);
300 expect(child.exists, isFalse);
301 });
302
303 test('file', () {
304 new io.File(join(path, 'myFile')).createSync();
305 Folder child = folder.getChildAssumingFolder('myFile');
306 expect(child, isNotNull);
307 expect(child.exists, isFalse);
308 });
309
310 test('folder', () {
311 new io.Directory(join(path, 'myFolder')).createSync();
312 Folder child = folder.getChildAssumingFolder('myFolder');
313 expect(child, isNotNull);
314 expect(child.exists, isTrue);
315 });
316 });
317
296 test('getChildren', () { 318 test('getChildren', () {
297 // create 2 files and 1 folder 319 // create 2 files and 1 folder
298 new io.File(join(path, 'a.txt')).createSync(); 320 new io.File(join(path, 'a.txt')).createSync();
299 new io.Directory(join(path, 'bFolder')).createSync(); 321 new io.Directory(join(path, 'bFolder')).createSync();
300 new io.File(join(path, 'c.txt')).createSync(); 322 new io.File(join(path, 'c.txt')).createSync();
301 // prepare 3 children 323 // prepare 3 children
302 List<Resource> children = folder.getChildren(); 324 List<Resource> children = folder.getChildren();
303 expect(children, hasLength(3)); 325 expect(children, hasLength(3));
304 children.sort((a, b) => a.shortName.compareTo(b.shortName)); 326 children.sort((a, b) => a.shortName.compareTo(b.shortName));
305 // check that each child exists 327 // check that each child exists
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 expect( 370 expect(
349 folder.canonicalizePath(join('.', 'baz')), 371 folder.canonicalizePath(join('.', 'baz')),
350 equals(join(path, 'baz'))); 372 equals(join(path, 'baz')));
351 expect( 373 expect(
352 folder.canonicalizePath(join(path2, '.', 'baz')), 374 folder.canonicalizePath(join(path2, '.', 'baz')),
353 equals(join(path2, 'baz'))); 375 equals(join(path2, 'baz')));
354 }); 376 });
355 }); 377 });
356 }); 378 });
357 } 379 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/file_system/memory_file_system_test.dart ('k') | pkg/analyzer/test/source/package_map_provider_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698