| 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 // Directory listing test. | 5 // Directory listing test. |
| 6 | 6 |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 import "dart:isolate"; | 8 import "dart:isolate"; |
| 9 | 9 |
| 10 class DirectoryTest { | 10 class DirectoryTest { |
| 11 static void testListing() { | 11 static void testListing() { |
| 12 bool listedDir = false; | 12 bool listedDir = false; |
| 13 bool listedFile = false; | 13 bool listedFile = false; |
| 14 | 14 |
| 15 Directory directory = new Directory("").createTempSync(); | 15 Directory directory = new Directory("").createTempSync(); |
| 16 Directory subDirectory = new Directory("${directory.path}/subdir"); | 16 Directory subDirectory = new Directory("${directory.path}/subdir"); |
| 17 Expect.isTrue('$directory'.contains(directory.path)); |
| 17 Expect.isFalse(subDirectory.existsSync()); | 18 Expect.isFalse(subDirectory.existsSync()); |
| 18 subDirectory.createSync(); | 19 subDirectory.createSync(); |
| 19 Expect.isTrue(subDirectory.existsSync()); | 20 Expect.isTrue(subDirectory.existsSync()); |
| 20 File f = new File('${subDirectory.path}/file.txt'); | 21 File f = new File('${subDirectory.path}/file.txt'); |
| 21 Expect.isFalse(f.existsSync()); | 22 Expect.isFalse(f.existsSync()); |
| 22 f.createSync(); | 23 f.createSync(); |
| 23 | 24 |
| 24 var lister = directory.list(recursive: true); | 25 var lister = directory.list(recursive: true); |
| 25 | 26 |
| 26 lister.onDir = (dir) { | 27 lister.onDir = (dir) { |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 testCreateTempErrorSync(); | 589 testCreateTempErrorSync(); |
| 589 testCreateTempError(); | 590 testCreateTempError(); |
| 590 testCreateExistingSync(); | 591 testCreateExistingSync(); |
| 591 testCreateExisting(); | 592 testCreateExisting(); |
| 592 testCreateDirExistingFileSync(); | 593 testCreateDirExistingFileSync(); |
| 593 testCreateDirExistingFile(); | 594 testCreateDirExistingFile(); |
| 594 testCreateRecursive(); | 595 testCreateRecursive(); |
| 595 testCreateRecursiveSync(); | 596 testCreateRecursiveSync(); |
| 596 testRename(); | 597 testRename(); |
| 597 } | 598 } |
| OLD | NEW |