OLD | NEW |
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; |
11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 | 12 |
13 import '../lib/src/io.dart'; | 13 import '../lib/src/io.dart'; |
14 import '../lib/src/utils.dart'; | |
15 import 'test_pub.dart'; | 14 import 'test_pub.dart'; |
16 | 15 |
17 main() { | 16 main() { |
18 initConfig(); | 17 initConfig(); |
19 | 18 |
20 group('listDir', () { | 19 group('listDir', () { |
21 test('lists a simple directory non-recursively', () { | 20 test('lists a simple directory non-recursively', () { |
22 expect(withTempDir((temp) { | 21 expect(withTempDir((temp) { |
23 writeTextFile(path.join(temp, 'file1.txt'), ''); | 22 writeTextFile(path.join(temp, 'file1.txt'), ''); |
24 writeTextFile(path.join(temp, 'file2.txt'), ''); | 23 writeTextFile(path.join(temp, 'file2.txt'), ''); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink)); | 423 expect(predicate(symlink2Path), equals(forMultiLevelFileSymlink)); |
425 }), completes); | 424 }), completes); |
426 }); | 425 }); |
427 } | 426 } |
428 }); | 427 }); |
429 } | 428 } |
430 | 429 |
431 /// Like [withTempDir], but canonicalizes the path before passing it to [fn]. | 430 /// Like [withTempDir], but canonicalizes the path before passing it to [fn]. |
432 Future withCanonicalTempDir(Future fn(String path)) => | 431 Future withCanonicalTempDir(Future fn(String path)) => |
433 withTempDir((temp) => fn(canonicalize(temp))); | 432 withTempDir((temp) => fn(canonicalize(temp))); |
OLD | NEW |