Chromium Code Reviews| 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 file I/O. | 5 // Dart test program for testing file I/O. |
| 6 | 6 |
| 7 #import("dart:io"); | 7 #import("dart:io"); |
| 8 | 8 |
| 9 class FileTest { | 9 class FileTest { |
| 10 static Directory tempDirectory; | 10 static Directory tempDirectory; |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 Expect.equals(12, input.positionSync()); | 460 Expect.equals(12, input.positionSync()); |
| 461 input.readListSync(buffer, 12, 6); | 461 input.readListSync(buffer, 12, 6); |
| 462 Expect.equals(18, input.positionSync()); | 462 Expect.equals(18, input.positionSync()); |
| 463 input.setPositionSync(8); | 463 input.setPositionSync(8); |
| 464 Expect.equals(8, input.positionSync()); | 464 Expect.equals(8, input.positionSync()); |
| 465 input.closeSync(); | 465 input.closeSync(); |
| 466 } | 466 } |
| 467 | 467 |
| 468 static void testTruncate() { | 468 static void testTruncate() { |
| 469 File file = new File(tempDirectory.path + "/out_truncate"); | 469 File file = new File(tempDirectory.path + "/out_truncate"); |
| 470 List buffer = const [65, 65, 65, 65, 65, 65, 65, 65, 65, 65]; | 470 // TODO(sgjesse): Handle this. |
|
Mads Ager (google)
2012/02/20 13:50:31
Should be handled before commit as well.
Søren Gjesse
2012/02/22 16:27:07
Done.
| |
| 471 // List buffer = const [65, 65, 65, 65, 65, 65, 65, 65, 65, 65]; | |
| 472 List buffer = new List(10); | |
| 473 for (int i = 0; i < 10; i++) { | |
| 474 buffer[i] = 65; | |
| 475 } | |
| 471 file.errorHandler = (error) { | 476 file.errorHandler = (error) { |
| 472 Expect.fail("testTruncate: No errors expected"); | 477 Expect.fail("testTruncate: No errors expected"); |
| 473 }; | 478 }; |
| 474 file.openHandler = (RandomAccessFile openedFile) { | 479 file.openHandler = (RandomAccessFile openedFile) { |
| 475 openedFile.noPendingWriteHandler = () { | 480 openedFile.noPendingWriteHandler = () { |
| 476 openedFile.lengthHandler = (length) { | 481 openedFile.lengthHandler = (length) { |
| 477 Expect.equals(10, length); | 482 Expect.equals(10, length); |
| 478 openedFile.truncateHandler = () { | 483 openedFile.truncateHandler = () { |
| 479 openedFile.lengthHandler = (length) { | 484 openedFile.lengthHandler = (length) { |
| 480 Expect.equals(5, length); | 485 Expect.equals(5, length); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 825 testAppendSync(); | 830 testAppendSync(); |
| 826 testWriteAppend(); | 831 testWriteAppend(); |
| 827 testOutputStreamWriteAppend(); | 832 testOutputStreamWriteAppend(); |
| 828 }); | 833 }); |
| 829 } | 834 } |
| 830 } | 835 } |
| 831 | 836 |
| 832 main() { | 837 main() { |
| 833 FileTest.testMain(); | 838 FileTest.testMain(); |
| 834 } | 839 } |
| OLD | NEW |