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 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 797 |
798 // Tests stream exception handling after file was closed. | 798 // Tests stream exception handling after file was closed. |
799 static void testCloseExceptionStream() { | 799 static void testCloseExceptionStream() { |
800 asyncTestStarted(); | 800 asyncTestStarted(); |
801 List<int> buffer = new List<int>(42); | 801 List<int> buffer = new List<int>(42); |
802 File file = | 802 File file = |
803 new File(tempDirectory.path + "/out_close_exception_stream"); | 803 new File(tempDirectory.path + "/out_close_exception_stream"); |
804 file.createSync(); | 804 file.createSync(); |
805 var output = file.openWrite(); | 805 var output = file.openWrite(); |
806 output.close(); | 806 output.close(); |
807 Expect.throws(() => output.add(buffer)); | 807 output.add(buffer); // Ignored. |
808 output.done.then((_) { | 808 output.done.then((_) { |
809 file.deleteSync(); | 809 file.deleteSync(); |
810 asyncTestDone("testCloseExceptionStream"); | 810 asyncTestDone("testCloseExceptionStream"); |
811 }); | 811 }); |
812 } | 812 } |
813 | 813 |
814 // Tests buffer out of bounds exception. | 814 // Tests buffer out of bounds exception. |
815 static void testBufferOutOfBoundsException() { | 815 static void testBufferOutOfBoundsException() { |
816 bool exceptionCaught = false; | 816 bool exceptionCaught = false; |
817 bool wrongExceptionCaught = false; | 817 bool wrongExceptionCaught = false; |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 testWriteStringUtf8Sync(); | 1331 testWriteStringUtf8Sync(); |
1332 testRename(); | 1332 testRename(); |
1333 testRenameSync(); | 1333 testRenameSync(); |
1334 }); | 1334 }); |
1335 } | 1335 } |
1336 } | 1336 } |
1337 | 1337 |
1338 main() { | 1338 main() { |
1339 FileTest.testMain(); | 1339 FileTest.testMain(); |
1340 } | 1340 } |
OLD | NEW |