OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 // | |
5 // Directory listing test. | |
6 | |
7 class DirectoryTest { | |
8 static void testListing() { | |
9 bool listedSomething = false; | |
10 Directory directory = new Directory.open("."); | |
11 | |
12 directory.setDirHandler((dir) { | |
13 listedSomething = true; | |
14 }); | |
15 | |
16 directory.setFileHandler((f) { | |
17 listedSomething = true; | |
18 }); | |
19 | |
20 directory.setDoneHandler((completed) { | |
Søren Gjesse
2011/10/10 14:58:00
Perhaps format like
directory.setDoneHandler(
Mads Ager (google)
2011/10/10 15:07:37
I like the current style better. I find the indent
| |
21 Expect.isTrue(completed, "directory listing did not complete"); | |
22 Expect.isTrue(listedSomething, "empty directory"); | |
23 directory.close(); | |
24 }); | |
25 | |
26 directory.setDirErrorHandler((dir) { | |
27 Expect.fail("error listing directory"); | |
28 }); | |
29 | |
30 directory.list(); | |
31 } | |
32 | |
33 static void testMain() { | |
34 testListing(); | |
35 } | |
36 } | |
37 | |
38 main() { | |
39 DirectoryTest.testMain(); | |
40 } | |
OLD | NEW |