| 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 // Dart test program for testing file I/O. | 5 // Dart test program for testing file I/O. |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 #import("dart:isolate"); | 8 #import("dart:isolate"); |
| 9 | 9 |
| 10 class MyListOfOneElement implements List { | 10 class MyListOfOneElement implements List { |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 } | 839 } |
| 840 Expect.equals(true, exceptionCaught); | 840 Expect.equals(true, exceptionCaught); |
| 841 Expect.equals(true, !wrongExceptionCaught); | 841 Expect.equals(true, !wrongExceptionCaught); |
| 842 openedFile.closeSync(); | 842 openedFile.closeSync(); |
| 843 file.deleteSync(); | 843 file.deleteSync(); |
| 844 } | 844 } |
| 845 | 845 |
| 846 static void testOpenDirectoryAsFile() { | 846 static void testOpenDirectoryAsFile() { |
| 847 var f = new File('.'); | 847 var f = new File('.'); |
| 848 f.open(FileMode.READ, (r) => Expect.fail('Directory opened as file')); | 848 f.open(FileMode.READ, (r) => Expect.fail('Directory opened as file')); |
| 849 f.onError = (e) => null; |
| 849 } | 850 } |
| 850 | 851 |
| 851 static void testOpenDirectoryAsFileSync() { | 852 static void testOpenDirectoryAsFileSync() { |
| 852 var f = new File('.'); | 853 var f = new File('.'); |
| 853 try { | 854 try { |
| 854 f.openSync(); | 855 f.openSync(); |
| 855 Expect.fail("Expected exception opening directory as file"); | 856 Expect.fail("Expected exception opening directory as file"); |
| 856 } catch (var e) { | 857 } catch (var e) { |
| 857 Expect.isTrue(e is FileIOException); | 858 Expect.isTrue(e is FileIOException); |
| 858 } | 859 } |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 testWriteVariousLists(); | 1079 testWriteVariousLists(); |
| 1079 testDirectory(); | 1080 testDirectory(); |
| 1080 testDirectorySync(); | 1081 testDirectorySync(); |
| 1081 }); | 1082 }); |
| 1082 } | 1083 } |
| 1083 } | 1084 } |
| 1084 | 1085 |
| 1085 main() { | 1086 main() { |
| 1086 FileTest.testMain(); | 1087 FileTest.testMain(); |
| 1087 } | 1088 } |
| OLD | NEW |