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 MyListOfOneElement implements List { | 9 class MyListOfOneElement implements List { |
| 10 int _value; | 10 int _value; |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 openedFile.writeList(new MyListOfOneElement(2), 0, 1); | 416 openedFile.writeList(new MyListOfOneElement(2), 0, 1); |
| 417 var x = 12345678901234567890123456789012345678901234567890; | 417 var x = 12345678901234567890123456789012345678901234567890; |
| 418 var y = 12345678901234567890123456789012345678901234567893; | 418 var y = 12345678901234567890123456789012345678901234567893; |
| 419 openedFile.writeList([y - x], 0, 1); | 419 openedFile.writeList([y - x], 0, 1); |
| 420 openedFile.writeList([260], 0, 1); // 260 = 256 + 4 = 0x104. | 420 openedFile.writeList([260], 0, 1); // 260 = 256 + 4 = 0x104. |
| 421 openedFile.writeList(const [261], 0, 1); | 421 openedFile.writeList(const [261], 0, 1); |
| 422 openedFile.writeList(new MyListOfOneElement(262), 0, 1); | 422 openedFile.writeList(new MyListOfOneElement(262), 0, 1); |
| 423 x = 12345678901234567890123456789012345678901234567890; | 423 x = 12345678901234567890123456789012345678901234567890; |
| 424 y = 12345678901234567890123456789012345678901234568153; | 424 y = 12345678901234567890123456789012345678901234568153; |
| 425 openedFile.writeList([y - x], 0, 1); | 425 openedFile.writeList([y - x], 0, 1); |
| 426 | 426 openedFile.close(); |
|
Mads Ager (google)
2012/02/23 08:57:44
Why did you need to rewrite this test?
Søren Gjesse
2012/02/23 10:26:42
Actually I didn't - reverted (I was testing callin
| |
| 427 openedFile.errorHandler = (s) { | 427 openedFile.errorHandler = (s) { |
| 428 Expect.fail("No errors expected : $s"); | 428 Expect.fail("No errors expected : $s"); |
| 429 }; | 429 }; |
| 430 openedFile.noPendingWriteHandler = () { | |
| 431 openedFile.close(); | |
| 432 }; | |
| 433 openedFile.closeHandler = () { | 430 openedFile.closeHandler = () { |
| 434 // Check the written bytes. | 431 // Check the written bytes. |
| 435 final File file2 = new File(fileName); | 432 final File file2 = new File(fileName); |
| 436 var openedFile2 = file2.openSync(); | 433 var openedFile2 = file2.openSync(); |
| 437 var length = openedFile2.lengthSync(); | 434 var length = openedFile2.lengthSync(); |
| 438 Expect.equals(8, length); | 435 Expect.equals(8, length); |
| 439 List data = new List(length); | 436 List data = new List(length); |
| 440 openedFile2.readListSync(data, 0, length); | 437 openedFile2.readListSync(data, 0, length); |
| 441 for (var i = 0; i < data.length; i++) { | 438 for (var i = 0; i < data.length; i++) { |
| 442 Expect.equals(i, data[i]); | 439 Expect.equals(i, data[i]); |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 900 testWriteAppend(); | 897 testWriteAppend(); |
| 901 testOutputStreamWriteAppend(); | 898 testOutputStreamWriteAppend(); |
| 902 testWriteVariousLists(); | 899 testWriteVariousLists(); |
| 903 }); | 900 }); |
| 904 } | 901 } |
| 905 } | 902 } |
| 906 | 903 |
| 907 main() { | 904 main() { |
| 908 FileTest.testMain(); | 905 FileTest.testMain(); |
| 909 } | 906 } |
| OLD | NEW |