| 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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 List<int> buffer = new List<int>(42); | 764 List<int> buffer = new List<int>(42); |
| 765 File file = new File(tempDirectory.path + "/out_close_exception_stream"); | 765 File file = new File(tempDirectory.path + "/out_close_exception_stream"); |
| 766 file.createSync(); | 766 file.createSync(); |
| 767 InputStream input = file.openInputStreamSync(); | 767 InputStream input = file.openInputStreamSync(); |
| 768 input.closeHandler = () { | 768 input.closeHandler = () { |
| 769 Expect.isTrue(input.closed); | 769 Expect.isTrue(input.closed); |
| 770 Expect.isNull(input.readInto(buffer, 0, 12)); | 770 Expect.isNull(input.readInto(buffer, 0, 12)); |
| 771 OutputStream output = file.openOutputStreamSync(); | 771 OutputStream output = file.openOutputStreamSync(); |
| 772 output.close(); | 772 output.close(); |
| 773 Expect.throws(() => output.writeFrom(buffer, 0, 12)); | 773 Expect.throws(() => output.writeFrom(buffer, 0, 12)); |
| 774 file.deleteSync(); | 774 output.closeHandler = () { |
| 775 asyncTestDone("testCloseExceptionStream"); | 775 file.deleteSync(); |
| 776 asyncTestDone("testCloseExceptionStream"); |
| 777 }; |
| 776 }; | 778 }; |
| 777 } | 779 } |
| 778 | 780 |
| 779 // Tests buffer out of bounds exception. | 781 // Tests buffer out of bounds exception. |
| 780 static void testBufferOutOfBoundsException() { | 782 static void testBufferOutOfBoundsException() { |
| 781 bool exceptionCaught = false; | 783 bool exceptionCaught = false; |
| 782 bool wrongExceptionCaught = false; | 784 bool wrongExceptionCaught = false; |
| 783 File file = new File(tempDirectory.path + "/out_buffer_out_of_bounds"); | 785 File file = new File(tempDirectory.path + "/out_buffer_out_of_bounds"); |
| 784 RandomAccessFile openedFile = file.openSync(FileMode.WRITE); | 786 RandomAccessFile openedFile = file.openSync(FileMode.WRITE); |
| 785 try { | 787 try { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1144 testWriteVariousLists(); | 1146 testWriteVariousLists(); |
| 1145 testDirectory(); | 1147 testDirectory(); |
| 1146 testDirectorySync(); | 1148 testDirectorySync(); |
| 1147 }); | 1149 }); |
| 1148 } | 1150 } |
| 1149 } | 1151 } |
| 1150 | 1152 |
| 1151 main() { | 1153 main() { |
| 1152 FileTest.testMain(); | 1154 FileTest.testMain(); |
| 1153 } | 1155 } |
| OLD | NEW |