| OLD | NEW |
| (Empty) | |
| 1 class DirectoryInvalidArgumentsTest { |
| 2 static void testFailingList(Directory d, var recursive) { |
| 3 int errors = 0; |
| 4 d.setErrorHandler((error) { |
| 5 errors += 1; |
| 6 }); |
| 7 d.setDoneHandler((completed) { |
| 8 Expect.equals(1, errors); |
| 9 Expect.isFalse(completed); |
| 10 }); |
| 11 Expect.equals(0, errors); |
| 12 d.list(recursive); |
| 13 } |
| 14 |
| 15 static void testInvalidArguments() { |
| 16 Directory d = new Directory(12); |
| 17 Expect.isFalse(d.exists()); |
| 18 try { |
| 19 d.delete(); |
| 20 Expect.fail("No exception thrown"); |
| 21 } catch (var e) { |
| 22 Expect.isTrue(e is DirectoryException); |
| 23 } |
| 24 try { |
| 25 d.create(); |
| 26 Expect.fail("No exception thrown"); |
| 27 } catch (var e) { |
| 28 Expect.isTrue(e is DirectoryException); |
| 29 } |
| 30 testFailingList(d, false); |
| 31 d = new Directory("."); |
| 32 testFailingList(d, 1); |
| 33 } |
| 34 |
| 35 static void testMain() { |
| 36 testInvalidArguments(); |
| 37 } |
| 38 } |
| 39 |
| 40 main() { |
| 41 DirectoryInvalidArgumentsTest.testMain(); |
| 42 } |
| OLD | NEW |