| 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 error handling in file I/O. | 5 // Dart test program for testing error handling in file I/O. |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 #import("dart:isolate"); | 8 #import("dart:isolate"); |
| 9 | 9 |
| 10 Directory tempDir() { | 10 Directory tempDir() { |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 closeFuture.handleException((e) { | 483 closeFuture.handleException((e) { |
| 484 Expect.isTrue(e is FileIOException); | 484 Expect.isTrue(e is FileIOException); |
| 485 port.send(null); | 485 port.send(null); |
| 486 return true; | 486 return true; |
| 487 }); | 487 }); |
| 488 closeFuture.then((ignore) => null); | 488 closeFuture.then((ignore) => null); |
| 489 }); | 489 }); |
| 490 }); | 490 }); |
| 491 } | 491 } |
| 492 | 492 |
| 493 testRepeatedlyCloseFileSync() { |
| 494 createTestFile((file, port) { |
| 495 var openedFile = file.openSync(); |
| 496 openedFile.closeSync(); |
| 497 Expect.throws(openedFile.closeSync, |
| 498 (e) => e is FileIOException); |
| 499 port.send(null); |
| 500 }); |
| 501 } |
| 502 |
| 493 main() { | 503 main() { |
| 494 testOpenNonExistent(); | 504 testOpenNonExistent(); |
| 495 testDeleteNonExistent(); | 505 testDeleteNonExistent(); |
| 496 testLengthNonExistent(); | 506 testLengthNonExistent(); |
| 497 testCreateInNonExistentDirectory(); | 507 testCreateInNonExistentDirectory(); |
| 498 testFullPathOnNonExistentDirectory(); | 508 testFullPathOnNonExistentDirectory(); |
| 499 testDirectoryInNonExistentDirectory(); | 509 testDirectoryInNonExistentDirectory(); |
| 500 testReadAsBytesNonExistent(); | 510 testReadAsBytesNonExistent(); |
| 501 testReadAsTextNonExistent(); | 511 testReadAsTextNonExistent(); |
| 502 testReadAsLinesNonExistent(); | 512 testReadAsLinesNonExistent(); |
| 503 testWriteByteToReadOnlyFile(); | 513 testWriteByteToReadOnlyFile(); |
| 504 testWriteListToReadOnlyFile(); | 514 testWriteListToReadOnlyFile(); |
| 505 testTruncateReadOnlyFile(); | 515 testTruncateReadOnlyFile(); |
| 506 testOperateOnClosedFile(); | 516 testOperateOnClosedFile(); |
| 507 testRepeatedlyCloseFile(); | 517 testRepeatedlyCloseFile(); |
| 518 testRepeatedlyCloseFileSync(); |
| 508 } | 519 } |
| OLD | NEW |