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 import "dart:io"; | 5 import "dart:io"; |
6 | 6 |
7 class DirectoryInvalidArgumentsTest { | 7 class DirectoryInvalidArgumentsTest { |
8 static void testFailingList(Directory d, var recursive) { | 8 static void testFailingList(Directory d, var recursive) { |
9 int errors = 0; | 9 int errors = 0; |
10 var lister = d.list(recursive: recursive); | 10 var lister = d.list(recursive: recursive); |
(...skipping 21 matching lines...) Expand all Loading... |
32 } catch (e) { | 32 } catch (e) { |
33 Expect.isTrue(e is ArgumentError); | 33 Expect.isTrue(e is ArgumentError); |
34 } | 34 } |
35 try { | 35 try { |
36 d.createSync(); | 36 d.createSync(); |
37 Expect.fail("No exception thrown"); | 37 Expect.fail("No exception thrown"); |
38 } catch (e) { | 38 } catch (e) { |
39 Expect.isTrue(e is ArgumentError); | 39 Expect.isTrue(e is ArgumentError); |
40 } | 40 } |
41 testFailingList(d, false); | 41 testFailingList(d, false); |
| 42 Expect.throws(() => d.listSync(recursive: true), |
| 43 (e) => e is ArgumentError); |
42 d = new Directory("."); | 44 d = new Directory("."); |
43 testFailingList(d, 1); | 45 testFailingList(d, 1); |
| 46 Expect.throws(() => d.listSync(recursive: 1), |
| 47 (e) => e is ArgumentError); |
44 } | 48 } |
45 | 49 |
46 static void testMain() { | 50 static void testMain() { |
47 testInvalidArguments(); | 51 testInvalidArguments(); |
48 } | 52 } |
49 } | 53 } |
50 | 54 |
51 main() { | 55 main() { |
52 DirectoryInvalidArgumentsTest.testMain(); | 56 DirectoryInvalidArgumentsTest.testMain(); |
53 } | 57 } |
OLD | NEW |