| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class DirectoryTest { | 7 class DirectoryTest { |
| 8 static void testListing() { | 8 static void testListing() { |
| 9 bool listedSomething = false; | 9 bool listedSomething = false; |
| 10 Directory directory = new Directory.open("."); | 10 Directory directory = new Directory.open("."); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 Expect.isTrue(completed, "directory listing did not complete"); | 21 Expect.isTrue(completed, "directory listing did not complete"); |
| 22 Expect.isTrue(listedSomething, "empty directory"); | 22 Expect.isTrue(listedSomething, "empty directory"); |
| 23 directory.close(); | 23 directory.close(); |
| 24 }); | 24 }); |
| 25 | 25 |
| 26 directory.setDirErrorHandler((dir) { | 26 directory.setDirErrorHandler((dir) { |
| 27 Expect.fail("error listing directory"); | 27 Expect.fail("error listing directory"); |
| 28 }); | 28 }); |
| 29 | 29 |
| 30 directory.list(); | 30 directory.list(); |
| 31 |
| 32 // Listing is asynchronous, so nothing should be listed at this |
| 33 // point. |
| 34 Expect.isFalse(listedSomething); |
| 31 } | 35 } |
| 32 | 36 |
| 33 static void testMain() { | 37 static void testMain() { |
| 34 testListing(); | 38 testListing(); |
| 35 } | 39 } |
| 36 } | 40 } |
| 37 | 41 |
| 38 main() { | 42 main() { |
| 39 DirectoryTest.testMain(); | 43 DirectoryTest.testMain(); |
| 40 } | 44 } |
| OLD | NEW |