OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // OtherResources=empty_file | 7 // OtherResources=empty_file |
8 // OtherResources=file_test.txt | 8 // OtherResources=file_test.txt |
9 // OtherResources=fixed_length_file | 9 // OtherResources=fixed_length_file |
10 // OtherResources=read_as_text.dat | 10 // OtherResources=read_as_text.dat |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 } | 981 } |
982 | 982 |
983 // Tests stream exception handling after file was closed. | 983 // Tests stream exception handling after file was closed. |
984 static void testCloseExceptionStream() { | 984 static void testCloseExceptionStream() { |
985 asyncTestStarted(); | 985 asyncTestStarted(); |
986 List<int> buffer = new List<int>(42); | 986 List<int> buffer = new List<int>(42); |
987 File file = new File(tempDirectory.path + "/out_close_exception_stream"); | 987 File file = new File(tempDirectory.path + "/out_close_exception_stream"); |
988 file.createSync(); | 988 file.createSync(); |
989 var output = file.openWrite(); | 989 var output = file.openWrite(); |
990 output.close(); | 990 output.close(); |
991 output.add(buffer); // Ignored. | 991 Expect.throws(() { |
| 992 output.add(buffer); |
| 993 }); |
992 output.done.then((_) { | 994 output.done.then((_) { |
993 file.deleteSync(); | 995 file.deleteSync(); |
994 asyncTestDone("testCloseExceptionStream"); | 996 asyncTestDone("testCloseExceptionStream"); |
995 }); | 997 }); |
996 } | 998 } |
997 | 999 |
998 // Tests buffer out of bounds exception. | 1000 // Tests buffer out of bounds exception. |
999 static void testBufferOutOfBoundsException() { | 1001 static void testBufferOutOfBoundsException() { |
1000 bool exceptionCaught = false; | 1002 bool exceptionCaught = false; |
1001 bool wrongExceptionCaught = false; | 1003 bool wrongExceptionCaught = false; |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1675 testSetLastAccessedSyncDirectory(); | 1677 testSetLastAccessedSyncDirectory(); |
1676 testDoubleAsyncOperation(); | 1678 testDoubleAsyncOperation(); |
1677 asyncEnd(); | 1679 asyncEnd(); |
1678 }); | 1680 }); |
1679 } | 1681 } |
1680 } | 1682 } |
1681 | 1683 |
1682 main() { | 1684 main() { |
1683 FileTest.testMain(); | 1685 FileTest.testMain(); |
1684 } | 1686 } |
OLD | NEW |