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

Side by Side Diff: sdk/lib/_internal/pub/test/io_test.dart

Issue 211373003: Speed up directory listing in pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
nweiz 2014/03/25 18:55:08 Since we don't have a custom implementation of dir
Bob Nystrom 2014/03/25 20:04:20 I figured it doesn't hurt to have them as regressi
nweiz 2014/03/25 20:14:12 I'd rather avoid pub being in the position of bein
Bob Nystrom 2014/03/26 00:51:38 OK, done.
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 io_test; 5 library io_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
11 import 'package:unittest/unittest.dart'; 11 import 'package:unittest/unittest.dart';
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 }), completes); 108 }), completes);
109 }); 109 });
110 110
111 test('works with recursive symlinks', () { 111 test('works with recursive symlinks', () {
112 expect(withTempDir((temp) { 112 expect(withTempDir((temp) {
113 writeTextFile(path.join(temp, 'file1.txt'), ''); 113 writeTextFile(path.join(temp, 'file1.txt'), '');
114 createSymlink(temp, path.join(temp, 'linkdir')); 114 createSymlink(temp, path.join(temp, 'linkdir'));
115 115
116 expect(listDir(temp, recursive: true), unorderedEquals([ 116 expect(listDir(temp, recursive: true), unorderedEquals([
117 path.join(temp, 'file1.txt'), 117 path.join(temp, 'file1.txt'),
118 path.join(temp, 'linkdir') 118 path.join(temp, 'linkdir'),
119 // dart:io documents that recursive symlinks will cause entries to
120 // appear twice.
121 path.join(temp, 'linkdir/file1.txt'),
122 path.join(temp, 'linkdir/linkdir')
119 ])); 123 ]));
120 }), completes); 124 }), completes);
121 }); 125 });
122 126
123 test('treats a broken symlink as a file', () { 127 test('treats a broken symlink as a file', () {
124 expect(withTempDir((temp) { 128 expect(withTempDir((temp) {
125 writeTextFile(path.join(temp, 'file1.txt'), ''); 129 writeTextFile(path.join(temp, 'file1.txt'), '');
126 createDir(path.join(temp, 'dir')); 130 createDir(path.join(temp, 'dir'));
127 createSymlink(path.join(temp, 'dir'), path.join(temp, 'linkdir')); 131 createSymlink(path.join(temp, 'dir'), path.join(temp, 'linkdir'));
128 deleteEntry(path.join(temp, 'dir')); 132 deleteEntry(path.join(temp, 'dir'));
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink)); 427 expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink));
424 }), completes); 428 }), completes);
425 }); 429 });
426 } 430 }
427 }); 431 });
428 } 432 }
429 433
430 /// Like [withTempDir], but canonicalizes the path before passing it to [fn]. 434 /// Like [withTempDir], but canonicalizes the path before passing it to [fn].
431 Future withCanonicalTempDir(Future fn(String path)) => 435 Future withCanonicalTempDir(Future fn(String path)) =>
432 withTempDir((temp) => fn(canonicalize(temp))); 436 withTempDir((temp) => fn(canonicalize(temp)));
OLDNEW
« sdk/lib/_internal/pub/lib/src/io.dart ('K') | « sdk/lib/_internal/pub/lib/src/io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698