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

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

Issue 215503004: Pub's listDir shouldn't fail when called within hidden directories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
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;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 expect(listDir(temp, recursive: true, includeHidden: true), 43 expect(listDir(temp, recursive: true, includeHidden: true),
44 unorderedEquals([ 44 unorderedEquals([
45 path.join(temp, 'file1.txt'), 45 path.join(temp, 'file1.txt'),
46 path.join(temp, 'file2.txt'), 46 path.join(temp, 'file2.txt'),
47 path.join(temp, '.file3.txt'), 47 path.join(temp, '.file3.txt'),
48 path.join(temp, '.subdir'), 48 path.join(temp, '.subdir'),
49 path.join(temp, '.subdir', 'file3.txt') 49 path.join(temp, '.subdir', 'file3.txt')
50 ])); 50 ]));
51 }), completes); 51 }), completes);
52 }); 52 });
53
54 test("doesn't ignore hidden files above the directory being listed", () {
55 expect(withTempDir((temp) {
56 var dir = path.join(temp, '.foo', 'bar');
57 ensureDir(dir);
58 writeTextFile(path.join(dir, 'file1.txt'), '');
59 writeTextFile(path.join(dir, 'file2.txt'), '');
60 writeTextFile(path.join(dir, 'file3.txt'), '');
61
62 expect(listDir(dir, recursive: true), unorderedEquals([
63 path.join(dir, 'file1.txt'),
64 path.join(dir, 'file2.txt'),
65 path.join(dir, 'file3.txt')
66 ]));
67 }), completes);
68 });
53 }); 69 });
54 70
55 group('canonicalize', () { 71 group('canonicalize', () {
56 test('resolves a non-link', () { 72 test('resolves a non-link', () {
57 expect(withCanonicalTempDir((temp) { 73 expect(withCanonicalTempDir((temp) {
58 var filePath = path.join(temp, 'file'); 74 var filePath = path.join(temp, 'file');
59 writeTextFile(filePath, ''); 75 writeTextFile(filePath, '');
60 expect(canonicalize(filePath), equals(filePath)); 76 expect(canonicalize(filePath), equals(filePath));
61 }), completes); 77 }), completes);
62 }); 78 });
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink)); 356 expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink));
341 }), completes); 357 }), completes);
342 }); 358 });
343 } 359 }
344 }); 360 });
345 } 361 }
346 362
347 /// Like [withTempDir], but canonicalizes the path before passing it to [fn]. 363 /// Like [withTempDir], but canonicalizes the path before passing it to [fn].
348 Future withCanonicalTempDir(Future fn(String path)) => 364 Future withCanonicalTempDir(Future fn(String path)) =>
349 withTempDir((temp) => fn(canonicalize(temp))); 365 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