| 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 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 testRepeatedlyCloseFileSync() { | 446 testRepeatedlyCloseFileSync() { |
| 447 createTestFile((file, port) { | 447 createTestFile((file, port) { |
| 448 var openedFile = file.openSync(); | 448 var openedFile = file.openSync(); |
| 449 openedFile.closeSync(); | 449 openedFile.closeSync(); |
| 450 Expect.throws(openedFile.closeSync, | 450 Expect.throws(openedFile.closeSync, |
| 451 (e) => e is FileIOException); | 451 (e) => e is FileIOException); |
| 452 port.send(null); | 452 port.send(null); |
| 453 }); | 453 }); |
| 454 } | 454 } |
| 455 | 455 |
| 456 testReadSyncBigInt() { |
| 457 createTestFile((file, port) { |
| 458 var bigint = 100000000000000000000000000000000000000000; |
| 459 var openedFile = file.openSync(); |
| 460 Expect.throws(() => openedFile.readSync(bigint), |
| 461 (e) => e is FileIOException); |
| 462 port.send(null); |
| 463 }); |
| 464 } |
| 465 |
| 466 testReadSyncClosedFile() { |
| 467 createTestFile((file, port) { |
| 468 var openedFile = file.openSync(); |
| 469 openedFile.closeSync(); |
| 470 Expect.throws(() => openedFile.readSync(1), |
| 471 (e) => e is FileIOException); |
| 472 port.send(null); |
| 473 }); |
| 474 } |
| 475 |
| 456 main() { | 476 main() { |
| 457 testOpenNonExistent(); | 477 testOpenNonExistent(); |
| 458 testDeleteNonExistent(); | 478 testDeleteNonExistent(); |
| 459 testLengthNonExistent(); | 479 testLengthNonExistent(); |
| 460 testCreateInNonExistentDirectory(); | 480 testCreateInNonExistentDirectory(); |
| 461 testFullPathOnNonExistentDirectory(); | 481 testFullPathOnNonExistentDirectory(); |
| 462 testDirectoryInNonExistentDirectory(); | 482 testDirectoryInNonExistentDirectory(); |
| 463 testReadAsBytesNonExistent(); | 483 testReadAsBytesNonExistent(); |
| 464 testReadAsTextNonExistent(); | 484 testReadAsTextNonExistent(); |
| 465 testReadAsLinesNonExistent(); | 485 testReadAsLinesNonExistent(); |
| 466 testWriteByteToReadOnlyFile(); | 486 testWriteByteToReadOnlyFile(); |
| 467 testWriteListToReadOnlyFile(); | 487 testWriteListToReadOnlyFile(); |
| 468 testTruncateReadOnlyFile(); | 488 testTruncateReadOnlyFile(); |
| 469 testOperateOnClosedFile(); | 489 testOperateOnClosedFile(); |
| 470 testRepeatedlyCloseFile(); | 490 testRepeatedlyCloseFile(); |
| 471 testRepeatedlyCloseFileSync(); | 491 testRepeatedlyCloseFileSync(); |
| 492 testReadSyncBigInt(); |
| 493 testReadSyncClosedFile(); |
| 472 } | 494 } |
| OLD | NEW |