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 Expect.throws(() { | 991 output.add(buffer); // Ignored. |
992 output.add(buffer); | |
993 }); | |
994 output.done.then((_) { | 992 output.done.then((_) { |
995 file.deleteSync(); | 993 file.deleteSync(); |
996 asyncTestDone("testCloseExceptionStream"); | 994 asyncTestDone("testCloseExceptionStream"); |
997 }); | 995 }); |
998 } | 996 } |
999 | 997 |
1000 // Tests buffer out of bounds exception. | 998 // Tests buffer out of bounds exception. |
1001 static void testBufferOutOfBoundsException() { | 999 static void testBufferOutOfBoundsException() { |
1002 bool exceptionCaught = false; | 1000 bool exceptionCaught = false; |
1003 bool wrongExceptionCaught = false; | 1001 bool wrongExceptionCaught = false; |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 testSetLastAccessedSyncDirectory(); | 1675 testSetLastAccessedSyncDirectory(); |
1678 testDoubleAsyncOperation(); | 1676 testDoubleAsyncOperation(); |
1679 asyncEnd(); | 1677 asyncEnd(); |
1680 }); | 1678 }); |
1681 } | 1679 } |
1682 } | 1680 } |
1683 | 1681 |
1684 main() { | 1682 main() { |
1685 FileTest.testMain(); | 1683 FileTest.testMain(); |
1686 } | 1684 } |
OLD | NEW |